A criminal acquires some credit card numbers, purchases a bunch of Windows keys online, and sells them through third-party websites at a cut rate. Other keys could have been purchased with stolen credit card numbers.
For example, Windows keys were once much cheaper in China. They may be legitimate, but they were sold for cheaper in other countries. These are referred to as “gray market” keys.
Some of these keys just come from other countries where Windows licenses are cheaper. The websites selling cheap Windows 10 and Windows 7 keys aren’t getting legitimate retail keys straight from Microsoft.