Here's a situation where Team A may choose to decline the yardage penalty.
:15 left in game Team A leading 13-10. 4th and 10 from their own 10.
Team A is trying to take an intentional safety on the play, and then kickoff leading 13-12....
Team A snaps the ball with :15 left, the QB backs into the end zone and runs around a bit, then is hauled down with a facemask by B in the endzone. The QB is tackled with :06 left on the clock.
Team A would like another play, 4th and 20 from the own 0, instead of 4th and 5 from their 15. (Harder to get back to the end zone, don't want to be tackled and give B the ball inside the 15).
In this play with :06 left, they could run around again, get a safety with :00, and clinch the victory, instead of having to kick off with :06 left.
Found a reason for Team A to decline the yardage, but still take the penalty. Go me!
(Or does declining the distance penalty make it a safety?
)