At the federal level, gift cards seem to be treated as a special case of electronic fund transfer. 15 U.S. Code § 1693l–1 and the corresponding regulations presently regulate disclosure of fees and expiration, and do not directly say anything about sale of such a card. There might be relevant state laws, though Washington state laws mostly mirror the federal law (also allowing issuing a card with an expiration date if given for no value to a charitable organization). You can actually get your last $5 back in cash in Washington per RCW 19.240.020.
A gift card / certificate isn't a "thing" in the way that an apple, hammer or table is, it's a contractual relationship. If you own a thing, you can freely re-sell it to whoever you want (assuming there isn't an express statutory prohibition against the sale of the thing). You cannot universally sell (assign) a contract right – there is a default preference that you should be able to, but Amazon has in this case said "No, you can't".