Now, is it mathematically correct to have a mortgage and have bonds in your investment portfolio?
Many of us think 100% stocks is best, regardless of mortgage status.
If you have bonds it's usually not for their return, but either:
A) Because rebalancing, or
B) Because smoother ride
Having a mortgage instead of bonds helps with neither (heloc could maybe help with the first, but traditional fixed long term mortgage, no).
So in either of those cases where you're wanting bonds, the correct option could be to take a mortgage out to put it into bonds, to give you the ability to rebalance easily, and to give your portfolio the smoother ride.
I'd still go stocks, but I don't see holding bonds as a reason to sell them to pay off the mortgage, when the point of them isn't return, but probably one of the above two.