For a mortgage loan to be deductible it has to have the home pledged as security for the loan.
If the investment does not have a lien in the home then it is not deductible mortgage interest.
I took a loan from a 401K to but a home and due to the 401K loan not being secured by the home it was not deductible.