I must apologize here, but I gave you the wrong information when I said you could exclude what you owe on the mortgage from your gain. I did not mean to include that amount in the calculations.
The amount you owe on the mortgage actually has nothing to do with the gain you have from the sale. Whether you owe the full amount of the sale price or if you owe nothing, it does not figure in to the calculations. If the original purchase price of the home was $38,000, then somewhere along the line you must have borrowed money against the value of the home as the value increased. That being the case, you are now simply repaying that loan, but it does not lower your gain on the sale.
You would be allowed to deduct the $20,000 closing cost and the $9,000 going to the buyer from the sale proceeds, but that still leaves you with a net gain of $250,000. Your share of that gain (73%) is $182,500. Your taxes at 15% would be $27,375 and at 20% would be $36,500.
I apologize for the confusion but wanted you to have the correct information.