Unfortunately, the sale of your mutual funds will be a taxable event no matter how the proceeds are spent. Depending on your tax bracket, some or all of the long term gain could be at the 0% long term capital gains rate, and the rest taxed at 15%.
Depending on the use of the house you purchase, there may be some deductible expenses such as points, real estate tax and mortgage interest to reduce your regular taxable income.
Thank you for your question,
If this home will be your principal residence or second home, then the home mortgage interest deduction may be available, subject to the $1 million dollar debt limit.
To have a mortgage solely for the tax deduction does not make sense, unless, as you say, you would rather keep your assets invested in your fund portfolio. For example, if you pay 20,000 in interest and you are in the 25% tax bracket, you would save $5000 in tax. Not a great trade unless the mutual funds are extremely profitable. Unfortunately, many people lost big with this strategy a few years ago. They borrowed big against their homes, invested in the stock market, and when both markets dropped down, they were stuck with the debt or were under water with their mortgage.
So, the answer really depends on the many aspects of your overall financial situation and how much risk you are comfortable with.