Good point, Oracle paid $5.6 billion for Sun, Google could have afforded that, they just offered $6 billion for Groupon. OTOH, that seems like a lot of money to pay just for Java.
Oracle bought Sun on a business model that saw them recouping the price of the acquisition not in proceeds from lawsuits but in shoe-leather sales to Oracle and Sun customers (which overlap intensely). Oracle already had the infrastructure to capitalize on that channel with Sun products.
Google had none of that. Had Google bought Sun, the first thing they could have expected would have been a shareholder revolt. The money isn't theirs to spend; it belongs, in large part, to Google's shareholders.