If it says “non transferable”, it may be a breach of contract to sell it, but it still wouldn’t necessarily be illegal. There is a difference between breach of contract (between two private parties) and breaking the law. Breach isn’t necessarily an illegality. The aggrieved party will, of course, have recourse for the breach though.
Unless something is non-transferable there is no reason why it cannot be sold. Sometimes a gift card is tied to a promotion through someone’s purchase of a service of some type. It might require ID in order to be used. In that case, they really should not sell such a card, as the person to whom they are selling did not buy the service. The latter is just my personal opinion. If it IS transferable, no one cares who uses it.