I think some people may be misintepreting this number. The actual event was free to attend.
The $2 charge was not the admission price, but the cost of a round trip train ticket to the event from anywhere in Texas. Other possibly more reliable sources say that this ticket varied in price and was as much as $5 depending on origin: http://www.lsjunction.com/facts/crush.htm.
So while there was a lot of economic activity associated with the crash, it wasn't the equivalent of a modern event with $2.4 million of gate receipts.
It looks like $2 was the daily wage for many skilled people during that era. Train conductors made about $3 a day, a carpenter would get $2.05, and an unclassified worker made $1.65.
Putting down rail would have been cheap. Since it was one time use they could take a lot of shortcuts - who cares if the next frost will twist the rails when you will be done before the next frost.
Probably the track they laid would have needed to meet only the most basic requirements, with minimal consideration of reliability, safety, longevity, etc.
For anybody else that was curious, in 1896 $2*40k = $2.4M in 2019
http://www.in2013dollars.com/us/inflation/1896?amount=80000