You need to teach your son that if he is going to do what others do, he is going to suffer the same consequences as the others.
He knew the "F" word was not appropriate yet made a decision to say it anyway. To put responsibility for that off onto another child is a disservice to your son. You are teaching him that he does not have to be responsible for his own behavior.
I simply cannot believe that your son has a hard time differentiating between acceptable language and unacceptable language. You are making excuses for him.
And unless this other child is the ONLY other child yours plays with, you cannot be certain that your son "learned" the word from him. I bet there are other children, and perhaps even some adults, who have used the word in his presence without your knowledge.
If you don't want your son to play with this boy, you'll have to tell your son that he's not allowed to play with that child. How you explain the "why" depends on what you want your son to repeat.