It's not that different than celebrities endorsing a charity for "free", they give up some time which gets positive PR and the charity gets the benefit of raising against their events.
Those charities who cannot generate lots if positive press can't help fund important research. Ironically sometimes research that crosses into another field and benefits another bug if research bring done.
You could (and people do) run a company absolutely ruthlessly applying only the metric of "What is the absolutely best way to make money".
Capitalism isn't nice it's just relatively efficient compared to other systems.
re: charitable giving. If they're giving, they're giving. Doesn't matter what the motive is. "huh, they're only funding a cure for cancer/starving kids/etc because it looks good". So fucking what? What are you doing to help those charities? Typing is easy, huh!
I'm not defending Oracle's activities ethically, but it seems a bit naive to expect corporations to show anything less than the most despicable, profit-seeking behavior allowed by law.
I'm not inside nor advanced enough to have a... really well-informed, well-grounded opinion, perhaps. But, I've seen enough of corporate behavior, across multiple substantial corporations over extended periods of time, to speak to that.
Even their "charitable giving." Even if is starts with or has components of genuine good will, by the time the suits, PR folks, and bureaucrats get done with it, it's pretty damned self-serving.