At least the US government heavily subsidizes leverage for real estate investment specifically, with institutions such as Fannie Mae for example. Absent that, no bank would offer a middle class individual a 30 year fixed rate loan for 80 - 95% of the value of a home. A loan to buy stocks on the other hand will typically be floating rate and the brokerage will retain the ability to liquidate your position AND require additional margin if your investments don't perform.
Fannie Mae has a short history page here for those interested: https://www.fanniemae.com/about-us/who-we-are/history