Yes, this is a special situation referred to as a claim of right. When you pay back income in a later year, how it's treated depends on the amount of the repayment. If the repayment was less than $3000, due to changes in the tax law for 2018 it is no longer deductible.
If your repayment was greater than $3000, you have a choice to take a credit or a deduction. The computation of the credit is somewhat complicated, because you have to refigure your tax from the prior years which relate to the overpayment. Please see IRS Publication 915, page 15, under Repayments More Than Gross Benefits, Deduction More than $3000.
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"