Users buy the OS with the computer, and Apple doesn't incur any extra cost from users using it (maybe cloud-based AI will change this though?), and it doesn't require additional payments. Meanwhile, services like iCloud+ do require payment.
Maps is a service, like iCloud, but users have been trained to expect it for free, with basically every other maps provider using ads to fund it. I suspect that most users think that ads are a better user experience than not using it at all because they won't pay $9.99/month for maps.
Maps is also a search engine, and ads are the primary way to fund search engines. I guarantee that if Apple every launches iSearch they will eventually fund it with ads.