It's not the computer that Microsoft is selling, it's Windows. It's apples and oranges (no pun intended). Apple doesn't charge for its software and Microsoft has many other products. It's just about how you distribute your costs.
FWIW, Microsoft has a much higher profit margin than Apple.
Id argue that at this point, Microsoft isn't selling Windows. They're selling everything/anything touching their platform.
Copilot, Office, Azure, gamepass. Almost all of these have a yearly subscription price that exceeds or is close to that of a Windows license. Windows just happens to be the platform they use to get you in.