The example of good company is like a person who is with a perfume seller. In his shop you would either buy some perfume, or he would give you some for free, or at least you would smell the pleasant odour. You would benefit in some way or the other.
The example of bad company is like a blacksmith. Either you would burn your clothes, or get some of the bad odour on you, or at the very least you will have to smell a bad smell. Either way, his company affects you unpleasantly.
In good, pious company a Muslim only benefits. In bad company, you only lose. Choose your friends wisely.
[Adapted from the Hadith of Bukhari and Muslim]