And honestly, it isn't that much upfront. Generally cheaper than a house with monthly payments lower than rent, and that is including lot rent, if you have it. Total rent is generally cheaper than a like sized house if you are just renting. No shared walls. You can often have pets.
When your option is to rent part of a house, especially from a not-so-wonderful landlord, this is a nice option. It literally doesn't matter if you don't get your money back or if it doesn't seem like a good investment.
Few folks are in it for the investment, but honestly, most folks aren't really buying a house for the investment, but rather that they get some freedom and security (the bank won't kick you out for willy-nilly reasons: A landlord can simply decide not to renew your lease, at least in places with poor renter's protections). Quality of life things are important.
None of this is a secret, either. Every poor person I knew that saw trailers as a better option than renting knew the downsides.
On the other hand, in many places I've lived, owning or renting a trailer was the closest folks can get to a house or the easiest/cheapest way to get a place with space.