S.Z.
Unfortunately, the movies, songs and comedians your son - and everyone else! - sees seem to show that the obnoxious smart mouths are the ones everyone loves. Kids think that if they're sarcastic and mean spirited, it makes them smart and funny and that will make them loved. When they see that no one is responding to them, instead of dialing it back, they ramp it up, thiniking that they need to do more in order to be funny. Think about commercials and previews - the more obnoxious a performer is, the more likely thay are to have a hit.
He's given you a perfect opportunity to explain by using the word "mean." Point out that using descriptions like, "dumb" and "stupid", and laughing at anybody, IS MEAN. Tell him that your family rules do not allow for anyone top be disrespectful, sarcastic or mean spirited. And don't ever let it go on and on and on for several minutes (or even several comments.) Set a very clear consequence - any time he says something inappropriate, whether it's at school, home, a friend's house, the store or anywhere, he will lose a privilege, and name that privilege. Start taking away things he enjoys - TV, video games, playing with friends. Do it the first time he says something, not after a whole stream, and do it every time.
Try to find ways for him to get positive attention, too, and praise anything he does well. Praise any time he makes a big effort. Help him find a talent - music, sports, writing, art, acting - that will help him see that he can get attention without being obnoxious.