There's already free ad-free social media, see countless services in the fediverse

Who pays for the costs of those and why?

There are many Mastodon servers run by ordinary people simply because they want to. And before the shit-show the internet has become, there were many forums and IRC channels, absolutely free, and with 0 ads.