It's probably because Google is perceived as giving you something like search, email, maps etc, which is very valuable, and "in exchange" it does stuff that does not directly impact your life. Similarly with Apple, which also works as a status symbol.
The sequence is also important: first they build services and products, sell (or give away) them on their merits, and then turn the analytics to 11. Doing both at the same time is a no-no, but once a user is dragged in, natural laziness and other migration costs kick in.
They are long cons, and to be fair, the products are pretty nice.