Apple is a hardware company. Selling their OS separately means they don't make all that money they currently make on the hardware they sell. For them, there is more money to be made in the premiums they get on their hardware than there is in selling the OS.
Plus, OS X is good and stable because it doesn't have to support every off the shelf part you can buy down at your local CompUSA. They know what video card is going to be in the box, so they can write drivers just for that.