the datacenter doesn't have a few million dollars to spare.
The heat is waste heat. If it cannot be recovered as a profitable source of energy, the datacenter won't be able to pay that few million dollars.
Recovery isn't the issue, the issue is that district heating systems are pretty much a rarity across the world for a number of reasons. Recovering waste heat - no matter if from datacenters, industrial processes or eve wastewater/sewage - is trivial, but getting the heat to somewhere it still can have a productive "secondary usage" is a massive and expensive problem.
> the datacenter doesn't have a few million dollars to spare.
What makes you think so? Datacentres are already very expensive, and getting permissions quicker (or at all) might be worth a couple million dollars.
> The heat is waste heat. If it cannot be recovered as a profitable source of energy, [...]
Yes, they should make all deals that make sense for both parties, definitely. But it's only viable in some places some of the time.