If you don't want to read much further, here is how Runescape does it...
1. Offer virtual prizes only.
2. Create a barter system where players can exchange real money for virtual currencies.
Combined these two work like this...
Virtual prizes are not counted as gambling by bodies such as the UK Gambling Commission and the Australian Communications and Media Authority.
So by itself this is enough to sustain a gambling operation in Runescape.
However there is a problem. Not every player has access to a credit card to buy gambling spins/tickets/keys or whatever the gambling game requires. Children fall into this category. Runescape is aimed at the 13+ age market.
But what if players could buy an item from Runescape and exchange it with other players for ingame currency. In Runescape that item is called a Bond.
Every Bond in Runescape has been bought with real cash. They can be exchanged to other players for ingame items, and those other players can use them for gambling spins or other items such as extra membership time.
This allows players without access to credit cards to play Runescape as members and to gamble, if they can make enough ingame currency to keep buying Bonds from other players.
Which means if a player was to get addicted to gambling then it's easy enough to feed the addiction, just keep playing Runescape. No money required. Yet Runescape makes money.
Of the $130 million Runescape made last year, about $30 million was from this gambling.
Runescape is operated by Jagex Ltd. of Cambridge UK.
Jagex Ltd is owned by New York investment bankers; Insight Venture Capital, Spectrum Equity and The Raine Group.
Runescape has had over 200 million accounts made.
It's worth noting that Runescape only banned gambling between players after Runescape had introduced Squeal of Fortune (now Treasure Hunter), because obviously the player run gambling competed with Runescape's gambling.