Long answer short, they make money by you placing bets with them.
Sportsbooks are betting that you’ll lose more than you win.
Meanwhile, casinos always set their return-to-player percentage to under 100%. That means, if you’re playing a game with a 97% RTP, 3% of your bets over time will generally end up in the pockets of the casino and/or game creators.
And in poker, you’re generally charged a tournament fee or rake every time you sit down at a tournament or cash game. All that goes straight to the operator.