You can find cheap OEM Windows-key resellers on Amazon and e-bay. But if your sources were referring to a dedicated site for software licenses, Kinguin.net is probably the best known site for key resellers.
Note that in each of these cases, you are dealing with individual resellers rather than actually Amazon or ebay. But all these sites have some measure of buyer protection, ostensibly.
As to legality, the keys being sold are usually unactivated OEM keys, and more rarely, volume license keys. The software license for these keys state that they are not intended for resale, although the actual legal status is murky. The EU has found in favor of users legally being able to resell keys and licenses, but the US has not, so if you are selling in the US, you may not have legal protection for your use and purchase of said keys.
The keys you get will almost certainly activate Windows, but there is no guarantee that MS can not deactivate the key at a later date, especially if you are not in a legally protected zone like the EU.
If you're selling your PC, it's probably safest to leave the issue of buying and activating keys to the customer. You can preinstall an unactivated copy of Windows, or bundle a USB install drive, and tell them to get their own Windows key, and leave it up to them where to source it from. Alternatively, if the PC that you are selling is using an OEM key, the Windows key is tied to the motherboard and will not activate for you if you build a new computer and try to activate it on that. So you could just sell the PC with the key that it was using before, just be sure to do a clean install that is not linked to your MS account, and to deactivate the PC from your list of authorized devices on your Microsoft Account control panel.
Wind, Sand and Stars.