Because of tunnels and "snow galleries" that protected the locomotives from snow. But it was quickly realized that when ordinary locomotives went through these tunnels the smoke, soot, cinders and heat flies back and enters the control area, blinding the engineer, and that's never a good thing.
The space in the tunnel is small, and as the steam engines became more powerful, the smoke became more daunting . And soon the locomotive engineers began to suffocate from this smoke it was a real threat to people's lives.
And then the South Pacific leadership had an idea to move the car forward. In 1911 the Baldwin plant in Philadelphia got the first orders for the "Inverted" locomotives.
With this arrangement of the cabin the visibility was excellent, and smoke was no longer a problem for the crew.