GMail does make some direct revenue for Google (ads and paid storage), but it was (and probably still is) their #1 method for onboarding users to the Google Accounts system. And that gets them access to pay for all sorts of Google products. GMail has been key in growing Google's active user base.