Yah, at this age, and if in preschool as well, it happens.
Your boy is having fun... and he's picking up things from the playground... my friend's son is that way too... he feeds off of the atmosphere of the other "wild" kids. Once they start school, this can happen.
What we did with our kids.... even when younger than 3, is we taught them people skills. Meaning, teaching them how to "discern" people's characters.... by their actions/voice/expressions etc. And how to make wise choices. For instance: if we were at a playground and there was a boy who was bossy-ing the other kids and being mean.... I would ask my kids "What do you think about how he is acting?- is it nice, or mean? Do you think he is nice....? Then I would let my kids respond and tell me their thoughts. Mostly they would say "boy is mean." And I would say "Why?" then they would say "he is bossy... and not letting the kids play on the slide..." I would say "Is that someone you would want as a friend? or not?"... and they would think and say "no. He is mean." Then I would say "What if he was mean to you?" Then they would say "I would tell him stop... then play somewhere else and tell you... or tell his Mommy..."
The point being.. talking it out, walking them through the process of "evaluating" and "discerning" kids/people who are just troublemakers or not. And thereby helping them to discern who to befriend.
For my daughter, it has served her very well. She is very articulate and keen in judging situations and character of people... more so than some adults. She can navigate herself and literally "chooses" friends very well. She can "read" people and is often correct. My son, is only 3, but he is developing this "skill" too. It is teaching them, HOW to evaluate... not just letting them choose unwisely... giving them the aptitude and skills to do so, as well. Because, yes, to a certain extent, we CAN "choose" their friends... by teaching them how to ascertain things. In time. So that they can develop best judgment.
But kids are kids.. .and yes, they might like a kid that we can't stand or feel they are a bad influence. So again, teaching them how to evaluate & discern people/situations is really helpful, in the future.
But my son, who is 3... also loves "yucky" jokes too... he just thinks its funny... but I know its a phase and he's a boy, and he likes to get a rise out of his sister. It will pass.
But teach him boundaries... 3 is a naturally hard age. 2 years old is nothing, compared to the 3's.
Good luck,
Susan