Casinos don't have to mechanically rig their games to profit from gamblers. Instead, they profit by paying less than they should according to the actual odds of whatever game you're playing. For example, roulette wheels have 37, 38 or 39 numbers on them (depending on whether they have single, double and triple zero slots), so they should pay you 37-, 38- or 39-to-1 for a hit (depending on the wheel configuration), but they don't. They pay 35-to-1 instead. If they paid fairly, then all things being equal the casinos and players would both break even. That's not profitable though, so casinos are allowed to just pay you less per win. That and fucking slot machines. Those things are just money vacuums.
Insurance is a similarly-rigged gamble. Insurance companies profit when they pay less in claims than they receive in premiums. The "trick" is figuring out what premiums to charge to ensure that happens. They have spent centuries developing actuarial tables for fuckin' every possible contingency and outcome. They know exactly how likely an 18 year old male is to screw up, leading to a claim, and the average payout for such claims. Besides age and sex, they consider driving history, education status, grades and even credit scores. An honor student with a clean record, fast-tracking into college and who has no debt is a little less likely to generate a claim than a deadbeat dropout with a handful of speeding tickets, a six-month stint in juvie and horrible credit. The former is "more responsible" than the latter. So they calculate what to charge each 18 year old male, and the former gets a lower premium.
Fun fact: if an 18-year-old woman gets married, most insurance companies will immediately move her to the "married over 25" bracket instead, drastically reducing her premiums. Getting married is not quite as much of a boon for men, but it does still reduce their premiums too. For some reason, getting married seems to (genuinely) mellow people out as drivers and make them safer (maybe because they don't want to risk their spouse's safety by driving more aggressively).
The calculations are much more complex for the insurance industry than the gambling industry, but it essentially works out the same way. If insurance companies sought to break even instead of generating profit, their calculations would be set to compute how much to charge every demographic to ensure they had just enough money to pay out claims without becoming insolvent, and maybe a buffer to stay solvent in the event of a "wild swing." Whereas a casino pays less than it should per winning bet, insurance companies charge more than they "need" to cover expected claims. All things being equal, just like a casino, if they charged "just enough" it'd be a break-even scenario.
And finally, casinos can also "cheat" by deciding, for any (or no) reason, to bar a player from gambling there anymore. Obviously if they think you're cheating, they'll toss you out whether you are or not, but even if they have no reason to think you're cheating, they can still toss you out just for winning too much. Sure, they love it when a high roller has a hot streak at the craps table (because it excites the crowd and encourages more wagering), but if you win 20 bets in a row (whether you're throwing the dice yourself or not) and you've scooped tens of thousands of dollars in winnings into your pocket, once the hype winds down you're likely to get a polite congratulations on your play and a polite-but-firm insistence that you can't play anymore. If you're not cheating, they'll still cash out your winnings for you, but they'll generally ban you from ever playing there again.
Insurance companies do the same thing. They can "cheat" by deciding "nope, we're not covering you no matter how much you pay," i.e. denying coverage even if you can afford the premium their actuarial tables say they should charge. For a casino it's more of a "gut feeling" than anything -- "this guy's winning too much, so get rid of him even if we can't prove he's cheating." For insurance, it's a matter of realizing a small portion of potential customers are such high risk that the premium they'd have to charge to break even over time is so high they'd never convince anyone to pay it, so they just say "nah, try somewhere else."
Of course, casinos do occasionally straight-up cheat, and insurance companies are notorious for "cheating" by coming up with any excuse they can to avoid paying out on a valid claim. But that's just plain greed. Neither industry needs to explicitly cheat. Casinos just have to under-pay and insurance companies just have to overcharge to maintain a steady profit.