They do it because of greed and the everlasting thirst of large companies to grow bigger and bigger.
They literally gave Windows 10 and 11 away for free if you had Windows 7 or 8.
Many if not most people pay for Windows in the form of licensing costs included in the price of a device, mainly laptops. Most laptops come with Windows preinstalled, and Microsoft earns with every laptop sold with Windows preinstalled. People building their own PC and getting an OEM key for cheap off of eBay or pasting a one-liner into PowerShell are the minority.
Do you really expect people to go out of their way to purchase a retail Windows license when they already have a perfectly valid and activated version of Windows preinstalled on their device?
And now that Windows 10/11 is a nice mix of adware, bloatware, nagware and spyware, do you really think it's worth $199 (for the "Pro" version)?
It's a business model Microsoft deliberately chose. Guess what? They were doing just fine before doing what they do now, despite of a few "software pirates".
I'd happily pay even a subscription fee for Windows if Microsoft didn't try to shove their crap down my throat every chance they get.