Hate to be “that guy”, but this isn’t regulation or government. Rather it’s the free market with actors willing to do anything to make gentrification profits. Which are, unfortunately for our society, quite sizable.
You can have flophouses. Officially or under the table. But you can’t have them in areas with the vultures circling so to speak.
Not saying gentrification is good or bad. Just saying, if gentrification profits are there to be had, it’s a bit foolish to expect people to not do whatever it takes to secure those profits.