Yeah I often wondered about it but if you look it up, they are legally sold.
In the EU, software license resale is legal, even if explicitly forbidden by terms of any EULA or other contract imposed upon the parties. To quote the European Court of Justice's press release on its ruling in a case...