Owing on an 2021 Amended Returned 1 year later after filing on time and receiving a refund last year

I am helping a friend amend 2021 taxes right now. They filed on time last year and they received a refund of $2,000. Then while working on 2022 tax return, it was discovered that some income was missing on the 2021 return. So we are amending 2021 return in Turbotax and adding the income. Turbotax says they now owe $5,000 on the amended return and this can be debited from the bank account. Our question is...they pay the $5,000, how is the refund of $2,000 already received come into play here? Is it not included when calculating the $5,000 and they will also owe the $2,000 back to the IRS on top of the $5,000? Or do they really only owe only $3,000 ($5,000-$2,000)? Or did Turbox tax take it into account? It appears unclear and would be grateful for guidance. Thanks!