Part of why cashless works is the same reason the Swedish welfare state generally works: a trust of government. Contrast this with Germany and its history with...lists; it's best not to have yourself be too traceable. I think the US is somewhere in-between, but at the end of the day, we'll hand over a lot for 2% cashback and avoid paying for journalism at all costs.
The card PoS's come in two forms; one that only takes the Danish Dankort (which is the cheaper) and one that also accepts foreign cards.
Which is why merchants in Denmark - at least smaller ones - are still weary about upgrading to the fancy PoS, and therefore need to accept cash some times. Sure, there are alternatives to that, like MobilePay. But usually your problem will be with tourists, who don't have access to that, nor access to a Danish card, and can only pay cash. (Another good reason why governments won't abandon cash; they'd lose a lot of tourists too.)
I don't know whether PoS's are cheaper in Sweden than in Denmark, but generally speaking, Danes and Swedes have about the same level of trust in government, yet there are far more cash transactions in Denmark compared to Sweden.