it doesn't work like that - 'using the funds' has nothing to do with the mortgage.
let's say you buy a home for $300,000 and take out a $200,000 mortgage to do so. That $200,000 is considered 'acquisition debt'
then later, when the balance has amortized to $175,000, you do a cash out refinance and now the balance is $225,000. (or simply take out a HELOC for $50,000 - it's the same end result). The interest related to the $50,000 of cash out (or HELOC) is not deductible unless you use the money to build or substantially improve your home. So an home addition, a new roof, replacement of all the windows, etc. would qualify. Paying taxes (or buying a car or paying for a vacation) isn't building or substantially improving your home