I wonder how refund works. What if one buys the code, copies it and then ships the voucher back asking for refund? How do you invalidate the code without linking the code to the purchase?
No need to specifically invalidate the code inside to stop you from doing refund fraud.
So my guess would be Amazon doesn't take returns on giftcards in the first place.
Look at the hundreds of people online who bought Battlefield 2042 from Amazon. They ship a CD case with a slip of paper inside which has a code.
Hundreds of people tried to redeem codes that had already been used.
This happens to every code-consumption-based retailer. Thankfully Amazon still eats the cost of "doing business" currently.