This is unrelated to how it was incorporated into the painting of railroads structures pre se, but the history and reasoning behind what you refer to as "barn red" is actually referred to in the paint industry of the 19th century as "red oxide", or "oxide red". This was because the colorant was iron oxide, a cheap and readily available colorant. Mix it up with a base like linseed oil, and you had an inexpensive, durable, and easy-to-work-with material. All assets enjoyed by barn owners and railroad bean counters alike!