Other mistake: The objective of the band is a cache of gold hidden some years ago in the firebox of a wrecked locomotive in the wilds of Northern Mexico. When they finally dig the firebox door out and open it, the strongbox is sitting inside a completely clean firebox, with nary a cinder, ash, or chunk of burned wood in sight. If the loco and cars had been abandoned after the derailment, there would still have been residue in the firebox.
Continuity mistake: At the start of the movie the train pulls into town. The loco, tender and 2 stock wagons pass the water tower, but the next shot shows the loco still alongside the water tower.
Factual error: Anne Margaret is seen changing into pants, and as she's shown stepping into the pant leg she is wearing white pantyhose. Pantyhose wasn't invented at this time.
Continuity mistake: In the final shot as the vintage train pulls away we see the back of the caboose pass by a very large satellite dish.
Factual error: One man reaches into the fire chamber and picks up the trunk full of gold with no problem or effort. That much gold would be much heavier.
Answer: It was established that railroad tracks were put through the desert. Probably a shortcut to save time or it was the only area they were allowed to build. Land deals, claim jumping and protected grounds were a big part of where tracks could be laid. It was after the train disaster that the tracks were discontinued.