In both cases, Google built a commodity that doesn't necessarily generate revenue for them. I don't think they're doing very well in this case.
Google's power is in controlling your interface. How you interact with the internet, and now, how you interact with AI, is dictated by them. There is massive power in being the interface between you and information.
Not directly, but they control the most popular portal to the open Internet with chromium to shape ad delivery, and (depending on how dramatic you want to be) the shape of reality presented to their users based on their AI models. Not directly profitable, but damn that's a scary level of power.
And it's amazing that they are doing very well overall without having to do too well to generate revenue.