You don't know for sure that they got away with it. I mean sure, you can check those accounts and see if they are still playing games, but that doesn't necessarily mean that those people weren't punished, especially with the way punishments work currently.
As of right now, punishments are given out in this order:
1.) 10 game chat restriction
2.) 25 game chat restriction
3.) 14 day ban
4.) Permanent ban
The punishment you receive is based on what you're last punishment is. So if your last punishment was a 25 game chat restriction, then your next punishment will be a 14 day ban, regardless of how minor the offense may have been. It is possible to be escalated straight to the 14 day/permanent ban, but that's only if Riot deems your case severe enough. Otherwise, you will follow this standard progression. Also, it is possible to lower your punishment level by one tier if you manage to go about 3 months without receiving a punishment.
Now, back onto "why weren't the others punished as well." Well, one explanation could be that they were punished, but their punishment level is lower than your friend's so they only received a chat restriction, which is impossible to know, unless you manage to catch them streaming.
Another explanation is that maybe they don't behave like this as often as your friend. Riot doesn't punish players for a single incident (unless it is very extreme). They punish players when they show a pattern of unacceptable behavior. Theoretically speaking, you could be "toxic" in 1 out of every 100 games, and it's likely you won't be punished because it's a rare occurrence. So maybe those other players don't behave like that very often.
Lastly, Riot's stance has always been that retaliation is unacceptable. If you're defending yourself from another player's toxic behavior with your own toxic behavior, all you really do is make the situation worse for the others around you, and doing this is punishable.