Apple and Google know the geolocation of every WiFi network in the US at this point. They could use signal strength as an additional measure if GPS is not accurate enough (though I'm pretty sure it is).