Deductions & credits

yes you can deduct the $5000 less any penalties or interest included.

 

the deduction would go on federal schedule A under state income taxes for the year paid.  if your tax deduction on schedule A is already $10,000, there will be no federal benefit. so there would be no purpose in filing an amending federal return.  federal tax laws for 2021 limit the schedule A deduction for income and property taxes to the $10k

 

however, if you have a resident state income tax that also taxed the gain you should be able to claim a tax credit because the income was double taxed.