IRS Publication 523 Selling Your Home - https://www.irs.gov/pub/irs-pdf/p523.pdf#page=17
There is no tax deduction for transfer taxes, stamp taxes, or other taxes, fees, and charges you paid when
you sold your home. However, if you paid these amounts as the seller, you can treat these taxes and fees as selling expenses. If you pay these amounts as the buyer, include them in your cost basis of the property.
Generally speaking, this only applies to business property.
expenses related to acquisition of the property are added to the cost basis of the property.
Expenses related to the acquisition of the loan are amortized (not capitalized) and deducted (not depreciated) over the life of the loan.