The have a massive advertising business, and charge for premium accounts. Not sure what makes you doubt them when other platforms, like Signal, have zero business model and are just providing services "out of the goodness of their heart" (not suspicious at all).
Probably doesn't cost much at all to run some servers to spin up javascript functions, compared to their massive storage costs. It's at best a fraction of a percent of total costs.
Whether or not they (or discord for that matter) can sustain a profitable business in the long term is another question.
But will it stay free, once enough people invested in it?
Telegram engaged in a bit shady crypto stuff, and let scammer bots roam freely. Also there are perks, if someones troll/harass/spam and scam groups and enough people report them, they get temporary or permanently restricted - unless they pay money to Telegram. Then they are free to troll again.
Source: https://t.me/devs/199669