While I agree with you that these problems are caused by using houses as a speculative vehicle, "only the initial sale should be profitable" would cause way way worse problems than this. This is a very ill thought out proposal, hammers destroy everything but nails.
The actual solutions to this problem are things like higher taxes on second properties, high capital gains tax on selling more than X homes in your lifetime (similar to the lifetime gift tax cap) or on "short term" speculative buys, reduction in ridiculous code and regulations on what sort of shelters people can live in/build for themselves, and I'm sure others I haven't thought of or heard of.
What happens when you're barred from selling it for more than you paid?
The seller will have a price cap but will have hundreds of people who want to buy it.
How do they choose?
Maybe lavish off-the-book gifts, or maybe they choose based on how the person looks, or perhaps they arrange consulting contracts to make up payment afterward.
Would you invest in your house if you knew you couldn't get any return on it? Or would you let it run to shambles?
Imagine you were a landlord renting a unit out and a new law prohibited selling it for more than you bought it. How would that impact your decision to maintain it? Would you spend money on updating the interiors, replacing carpets, putting up new siding, if you planned on selling it within a few years?
Suppose every landlord did this. What would a typical city block start looking like?
And so on.
When you tax land people don't suddenly stop producing more land.
I mean, OPs idea was silly beyond belief. Even the socialists dont say: "The only person who can profit from this are the capitalists (necessarily) who first build this. The buyer can't make a profit from the re-sale".
I met a builder once that you probably have never heard of. He is a billionaire. He can profit from the sale of homes, but my parent's can't? Never mind that the tripling of the price of my parent's home over the last 22 years was driven by silly economic policies. Otherwise the house would have appreciated maybe 50%.