Never said they lost money on LoL, it's impossible
I can guarantee you that Riot has an entire team working on nothing but figuring out what actions give them the most amount of profit, starting from marketing, skin prices, battle pass content, esports advertisement, merchandise, social media management and many more.
Franchising is 100% the best model, there is no way Riot doesn't have this shit figured out