I mean, it’s not the price of materials that dominate Apple’s pricing. And you actually have to pay money to people developing the OS. So no, it’s not free.
Microsoft bundles all sorts of software with their OS that can be installed separately for free, does that mean they're actually not free because development is funded through other product sales? A lot of their services have a free tier, are those services not free because there's a paid tier?
Apple's inflated hardware price certainly includes room for funding their OS development, but that doesn't mean the OS isn't free. Windows sales also likely go toward funding things other than OS development, but that doesn't mean that all of their products aren't free if you're running them on Windows.
MacOS is a premium product. Windows 10 Home edition is obviously not. You mention yourself in another comment that you estimate the cost of it to be around $40.
HN collectively throwing a fit because Windows 10 Home doesn’t fit their needs is silly, because they are not the target audience.
IF you intend to compare macOS with Windows, you need to compare same market segments, i.e. macOS and Windows 10 Pro.
https://www.apple.com/shop/help/downloadable_software