I starred this very insightful comment by Hacker News user marcinzm about search engines. The commenter noted the obvious, that big tech search shows ads because its purpose is to generate revenue through ads. But I appreciated the commenters putting it in terms of means and ends. Ideally, the user wants a search engine to be responsive to his or her query. That is, entering the query is the means for achieving the end of finding a useful result. However, commenter marcinzm noted that the end for the search provider is money and the search experience is a means toward creating more ad revenue. While this is not a novel point, it is phrased well here. One good anecdote is site-specific search, but this is an area that needs more work.
The money from showing a pancake ad make them do that. It's not a search problem. They know it's not a good experience but they also know it makes them more money than not showing it. The goal is money. Your experience is merely a means to that end.