Get a loan collateralized by investment portfolio, and invest that money?

I’m in the process of buying a house in Mexico. I could technically pay cash, but a friend suggested that, with inflation where it is, why not get a loan for half the value of the house, collateralized by my investment portfolio, and instead invest that money into stocks or bonds. Inflation will make the loan cheap, and I’ll get a better return with that money.

Why do you think? Is this is a good plan? Any reason not to do this?