Hesperia, was initially purchased in anticipation of the railroad coming through. Investors stood to make a nice profit from not only the railroad, but in the real estate near by as communities grew.
But the railroad was built to Mojave, where trains could easily be routed southward toward Los Angeles, or over the Tehachapis, then north to San Francisco. The Hesperia investment languished and then was passed on to others. The railroad came through much later, but it was not so much of a big deal then.