The thing is, even if you're talking to a friend, there are another 3 ( or 8 if all chat ) people in chat that will report you if they feel that what you said was wrong.
From the summoner's code :
Remember, taking a jab at your friend in the middle of the game is a lot different than making a glib remark at a complete stranger. Someone who is unfamiliar with what you consider playful may take your comment as an attack and react unfavorably.
You can try and contact the support but i doubt they'll remove the punishment since what you said is considered hate speech ( that is why you skip the chat restriction ).
https://i.imgur.com/ACZhFYu.png
The thing is riot can't tell if you're talking to a friend or not, and even if it's the case, context doesn't really matter for chat punishments, a few weeks ago we had a dude that had as an excuse "Yeah i said KYS but it was directed to a friend who was watching my monitor".
[sg-lux-2]
So i guess you can see that everyone could excuses themselves that way, now don't get me wrong i'm not saying you're lying in fact i believe you, but i want you to understand that riot can't remove your punishment just because you said that it was directed to a friend. They only remove punishments if they made a mistake in the first place, which apparently is not the case here.
Anyway be careful next time it's a permaban ! Use discord/TS/... when communicating with a friend :)
Good luck