Actually, a lot of the Mac code is hideous, and the OS encourages some weird programming.
Windows programming is also pretty klunky, unless you use Visual Basic, which is pretty nice (sometimes).
The reason why the Mac excels, while Windows lags, and Linux positively blows chunks, is that Apple, early on, based their interface guidelines on psychological research about human-computer interaction, and got their software engineers to understand some facts about interface. This, in turn, created the Mac "interface culture".
The best code is in the Linux world. The unix model of programming is elegant and simple. The OS is relatively simple. The code is exposed to the public, so the programmers work a lot harder to make it presentable.
There's no correlation between good code and good interface, but there is a correlation between concern about code and good code. Likewise, when the Linux community learns to accept interface designers (and gets more than a few to write interface libraries) the interfaces there will start to improve and will probably surpass the Mac's.