This is all an (informed) guess, but here's how I imagine it happened:
2005-ish MapQuest, Google Maps, etc. were all using Navteq and TeleAtlas as their data providers. Google was probably paying millions of dollars per year for licensing Navteq and TeleAtlas' entire data sets. They were probably dumping hundreds of expensive engineer-hours into merging these datasets, applying updates every quarter, dealing with customer feedback, etc.
In 2006 or so they probably did some napkin-math and saw that a) owning their own data would let them do whatever the heck they wanted with their maps (I bet Navteq wanted much more money for the ability to sell ads on top of their data) and b) over time, it would be cheaper to spend a few million shipping cars and paying drivers to collect their own data than handle the increasingly-unreliable commercial data vendors (remember that at the time the commercial vendors didn't have any competition and so weren't doing much more than driving new roads every few months). Also, for the most part geo-data is a one-time cost. The majority of the world's road network stays the same and further updates can be applied using customer feedback (MapMaker) or aerial imagery. Oh, they also had this handset project coming out called "Android" that needed access to a non-GPS method of determining location, so they strapped some wifi cards onto the cars.
I don't think there's any question that the millions of dollars they spent to collect and index the physical data of the world was worth it. It improved every single one of their core products: Maps, Earth, Ads, Local, Places, etc. all sprouted from this data that they collected. Also, the huge leap they took is slowly being replicated by the commercial vendors (Navteq started driving their version of StreetView a few months after Google announced their first city).