This seems to be in conflict with the common market principles. EU countries cannot economically discriminate against EU citizens, with only a few exceptions aimed at reduction of welfare tourism.
Or does Denmark have an opt-out?
And what about real property owned by legal entities? Czechia used to have a ban on real property ownership by foreigners before EU accession, but foreign investors would just create a local LLC and buy/build whatever they wanted.