They sell the drugs. If you have an illegal substance inside a jail or penitentiary, that illegal substance gives you power. They don't have money, as such, passing back and forth.
Even cigarettes can be a powerful weapon. You have control. An addicted smoker will do practically anything for a cigarette. If you're in jail for a long period of time, it could be as much as a cigarette for half of your meal tonight. They also have canteens there, so it could be a little bit of canteen, or perhaps even sexual favours.
So that's the motivation. The other part of it is simply having power over other people.