Someone who (at the time) was senior enough in an IBM/Red Hat joint role told me the plan was that IBM would buy Sun, essentially for their Telco and a few other key market segments. To avoid any anti-trust risks (which IBM was still institutionally paranoid about) that might come from owning AIX, Solaris, WebSphere, Java, and various other overlapping properties, they would spin much of the software division (including Java and Solaris) off to Red Hat.
Unfortunately for the free software world, IBM's lawyers got cold feet when it turned out that Sun were mired in bribery claims. Oracle didn't care. Pity, because actually having Java properly open sourced, and likewise with various other Sun technologies (e.g. an OpenSolaris that didn't rely on a couple of binary-only libraries, for example) would have been quite a net win.