It is frequently a very bad idea, but…
…demand for things that take a long time to make (like buildings) changes far faster then the supply can catch up. If you happen to have some of those things when demand shifts up you can sell them for far far more then it cost you to make them.
Unfortunately if demand doesn’t shift up you can be stuck with things that nobody will pay you enough to clear your costs for.
Some people taking a risk is normal, and it helps smooth things over if demand shifts up, and it isn’t too bad if demand stays flat (or shifts down). It becomes bad when lots of people do it (both because that many failure at once stress things, and because they contribute to the over supply which prevents the price from going up even if demand does go up!).