To you and me, that's a lot of money, for Google's size that's really not a lot of money. The fact that it just became profitable certainly helps the beancounters decide to keep it around though.
Being in Silicon Valley has warped my sense of money so much.
When I read $300m, what I read is "when you factor in office costs & health care as well as salary/stock grants, an average FAANG software engineer must be ~$1m. That's only 300 employees!"
It's a crazy way to think. Suddenly all prices that end with `m` and not `b` seem pointless.
Google includes the income from paid Gmail accounts in their cloud revenue. From all accounts, that is all of the profit and in fact it generates more profit that offsets the cloud losses.