Intent is irrelevant, if one is wiretapping then the other is also wiretapping
Mostly by offering value to their customers in the form of added services.
Google do it to allow themselves to provide a free email service.
Without the scanning of email done by google, everyone would have to pay for their email services.
You may or may not like the trade off, but apparently MANY people would prefer to have a free email service that provides advertising over a paid for email service that does not.
On reflection I think that would be a good thing.
At present > 95% of Google's revenue comes from advertising. Thousands of staff are involved in designing and implementing 'improved' advertising systems. Millions of hours are consumed by this every year.
If Google was forced to transition to a subscription service for Gmail it might force a general shift in their revenue model. I contend all that brain power could be redeployed to doing amazing things, rather than refining AdWords .
If we say analyzing your communication is ok as long as it makes money for the service provider and the service is free, we open a Pandora's box. Google (and anyone operating an SMTP server) would be able to sell HR reports to recruiters, insurability scores to insurers, predictions of criminality to police departments, infidelity scores to private detectives, etc. Advertising is not a specially protected business model.