Legal fees related to seeking a refund of individual income taxes normally would be deductible as a miscellaneous itemized deduction subject to the 2%-of-adjusted-gross-income floor. However, this deduction is suspended for 2018 through 2025. Win or lose, legal fees related to business taxes (but not personal taxes on business income) may be a deductible business expense.
Debt used to buy, build, or construct a principal residence or second home and that generally qualifies for a full interest expense deduction.