Becuse they are a monopolist and we can require certain things from monopolists.
Similarly, Bell Labs was kind of required to release transistor for anyone to license - it was a part of social contract that they were allowed to maintain their monopoly in exchange for releasing certain parts of technology.
Alternatively, they could be split up and their indexing division made an independent company selling to anyone on a free market.
I tend to agree - businesses should give back. But they can also keep some secrets.
R&D has steep cost. Publishing it all gives your competitors an advantage.