Because delivering ads to a few billion people is a hard problem which leads to needing good engineers. They pay _really_ well compared to smaller orgs because it's difficult to hire that talent and ads are _very_ profitable.
Thank God some of them are.