Forgive me for muddying the waters by introducing NCAA into this discussion. (I know nothing about NFHS rules.) However, in NCAA, if Team B declines the penalty for an illegal pass thrown from the end zone, by rule, the ball is placed at the previous spot for the next down, whatever it might be. Of course, 1st thru 3rd down, why would Team B give up the 2 points and give Team A an opportunity to get out of a jam with some sort of a great play? Late in the game, if Team B was behind by 3 or more points, they might want to gamble that they could play tough the next couple of downs and force a punt to get good field position for a field goal or TD. But that would be a big gamble, and would be rare, especially considering they could have 2 points plus an opportunity for decent field position following the free kick after the safety. But the opportunity is there.
However, 4th down is a different story. If this happens on 4th down, by declining the penalty, they get the ball at the previous spot, and, as the Wizard said, "That's a horse of a different color." Depending on time remaining, they might gladly give up 2 points and decent field position for 1/10 inside the A-20 (more likely, inside the A-10).
If the NFHS doesn't have this provision, they should probably think about it, even as rare as it would be.