But it's not heavily discounted. The markup is just lower. The way these affordable appartment laws are typically written, they are still allowed to profit on those appartements. A typical appartment costs around 250-350$ per square foot to build.
It's more profitable for them to sell appartements at 700$/sqft for only half of them to sell, costing them 350$/sqft to build, than to sell for 400$/sqft an appartment that cost 250$/sqft to build.
The disaster isn't that there is no access to the pool. The issue is that they're trying to spite the poors and shame them, because they're trying to prevent them from moving in.
If we really wanted, the government could build appartements of better quality and sell them at same price, AND make a profit on it.
As the above commenter said, it's simply a market failure. It has nothing to do with the price of the land or anything, it's that the appartements are seen as an investment asset and will be bought at an exorbitant price eventually, as long as the price of the appartment doesn't fall in that "luxury" building. It's gross resource misallocation.