I used to own an insurance company and I can tell you this is definitely a state law issue. An unused gift card, for some period of time, depending on the state, becomes ‘dormant funds’ and the business is required to turn the funds over to the state if they can’t find/contact the owner.
This is a way for state governments to raise funds. After some period of time, the state gets to take the funds. Even though they generally try to contact owners and publish lists, they don’t make it easy to recover the funds. So don’t count on that to get money back on previous gift card spend.