The idea isn't to borrowing against your home to invest.
Rather, the idea is that after you have your mortgage, you put your extra money towards your stock/bond investments rather than putting extra money into the mortgage to pay it off early.
This is because the interest on your mortgage is quite low compared to the long-term stock market returns (7-8% after taxes/inflation). So your dollars are more valuable there than spent paying off your mortgage.
In other words, if you take two people, each buys the same home, but one pours all their extra money into their home and the other pours it into the stock market, in 20-30 years the one who poured all the extra money into the stock market would have a much higher net worth.