I would like to find out the cost of a train ticket on the Santa Fe & Topeka railroad around 1940, from Alpine Texas to Santa Fe via El Paso.
To preface, you might be a little hard-pressed to find a consolidated database for rail fares information from that time period on the internet. The best case scenario would be local timetables that survived in some archive, or maybe internal correspondence that happens to include the pricing policies, both of which have a low chance to be digitized.
That being said, Kansas Historical Society has this archive index for Atchison, Topeka & Santa Fe
One of the documents mentioned is an advertisement "New Faster Schedules on the Santa Fe" dating from 1946. This could be useful to extrapolate a price, although the difference in the routes and the lack of prices on the advertisement limits its usefulness:
Another useful resource can be this compilation by Bureau of Transportation Statistics, which is a national average and only goes back to 1960:
That being said they seemingly have a direct line for library assistance, which can be a lot more helpful for your purposes: