This isn't a fictitious question either, because some countries do have such laws (with some level of exception for actual places of dwelling). At the core is the notion of being able to own something, which itself is something we feel is simple because of how common we engage in the act, but which philosophically is far more complicated to deal with than people give credit (even more so when one considers nature gives no sanctity to the body).
In general governments have 'good enough' laws that make enough people happy without getting to the real philosophical questions, but in doing so leave open edge cases which have unsatisfactory answers because the philosophy cannot be reconciled with the practice.
Next we'll be talking about "eroding the rights of people to buy the ocean".
See [PRC Division 20 Ch3](https://leginfo.legislature.ca.gov/faces/codes_displayText.x...)
Particularly:
> Development shall not interfere with the public’s right of access to the sea where acquired through use or legislative authorization, including, but not limited to, the use of dry sand and rocky coastal beaches to the first line of terrestrial vegetation.
This is an access point that has been used by the public for decades.
Essentially it erases the question of whether this might be a case of protecting the fundamental rights of our society from erosion, and reduces the problem to the immediate material circumstances. With all of that difficult nuance and caution gone, anybody who disagrees with the foregone conclusion is just a poor and stupid rube.