The penalty was declined.. There are a lot of things that are illegal in football..... holding, pass interference, chop blocks, and 2 forward passes on one play. That’s why the refs throw those yellow flags all over the place.
But if you do something illegal and get flagged, and the other team declines the penalty then whatever illegal activity that happened in the play gets disregarded and all parties get credit for what happened, be it yards gained or a turnover or sack or whatever took place.
The Rams were total morons for declining it. It was 3rd and 10. Brady was 8 yards behind the LOS when he made that second throw. It would have been 5 yards from the spot and a loss of down, resulting in 4th and 23. Instead they gained 8 yards resulting in 4th and 2. That’s a difference of 21 yards.
EDIT: And now a little something from the "you learn something new everyday" department.... to quote Fonzie, "I was wruh-wruh-wruhhhhhhhh.... wrong." A second forward pass thrown from behind the LOS is indeed a penalty but NOT a loss of down. So the Rams had 2 choices: Decline the penalty and set up 4th and 2 (which is what they did) or accept the penalty and set up 3rd and 23. That's a lot of yardage to give up, but since it set up 4th down, their decision makes sense.