I don't think they allow it necessarily. They have explicit licensing terms which say that MacOS can only be installed and used on Apple hardware.
How long they tolerate it is another question, and I don't think anyone knows for sure. But if hackintoshing becomes easier (imagine a one click installer on a Dell/HP/ASUS PC), I'd imagine they'd start pursuing people.
I think there was also an individual/company that would build PCs, install MacOS, and sell them for a profit. IIRC, they were shut down.
If I want to use an operating system based on Unix O/S with a fancy window system, I'll use Elementary OS and pocket the $600+ bucks, thanks. There is not a single Mac-only app that can't be replaced by a better app at free or equal cost.
https://www.tonymacx86.com/threads/guide-high-sierra-on-hp-s...
https://www.vice.com/en_us/article/8xznw4/how-to-make-a-hack...
But yeah... not easily enough that many consumers would consider doing it over directly buying a mac.