The biggest factor is almost certainly the subsidy for switching to a heatpump.
But there are other factors as well. Air to Air heatpumps are uncommon in Germany, we usually install Air to Water ones, which are more complex. Unlike other countries, our heat pumps are usually mounted on a concrete slab and not on the wall. Then there are some norms for quality of the water, etc. they aim to increase the lifespan of the system, but increase upfront costs
AFAIK we do all of that in Sweden. The 12k I mentioned above is if a large air to water pump suitable for the northernmost of Sweden. It includes a water heater and direct electric heating element for when temperature go below -15.
And why do subsidies INCREASE the price in Germany compared to Sweden?