San Francisco has[0][1][2][3] at least five combined heat and power plants that generate electricity and also sell steam to neighboring buildings via 72,000 feet of pipes.
I worked at a privately-owned for-profit "factory" in Santa Monica whose primary product was chilled water (their other product was warm water). They built pipelines to nearby large buildings and sold chilled water to them.
0: https://cordiaenergy.com/locations/san-francisco-3/ (2 for-profit CHP plants)
1: Skanska (for-profit)
2: San Francisco General Hospital
3: Apparently there are some "Muni" CHP plants scattered about SF as well (publicly-owned)
The real problem is stupid capitalism reprices everything good to the price of the non-good thing. Solar was supposed to be almost-free clean electricity, but the price of panels has been repriced to make them the same as dirty electricity.