One reason Denmark has very affordable district heating is that it is based on "waste heat" from power plants, and "waste heat" is exempt of energy taxes (because those are paid on the primary energy sale, i.e. the electricity).
This comes with some perverse incentives in an age of renewables:
1. If the power plants use surplus electricity to provide district heating it is no longer a "waste product" and consequently taxed. Since the power plant cannot run without generating electricity, this leads to periods of negative power prices.
2. Cooling water from e.g. data centers is too cold for district heating, but it would be energy efficient to use heat pumps to extract that energy. This is not done, because the product would be subject to full energy taxes as it is not a waste product.