Deductions & credits

yes, I agree, but the issue is around the definition of Sales Price.  The definition I see in publication 523 is that the  sales price is 'everything you received for selling your home'.  From Pub523 'Worksheet 2; How to Figure Your Gain or Loss',  the forms look at this calculation beginning with the money you receive, so the Selling Price would be after the mortgage loan in deducted from the proceeds.