The U.S. shale boom has profoundly increased crude oil movements by both pipelines— the traditional mode of transportation—and railroads. This paper develops a model of how pipeline investment and railroad use are determined in equilibrium, emphasizing how railroads’ flexibility allows them to compete with pipelines. We show that policies that address crude-by-rail’s environmental externalities by increasing its costs should lead to large increases in pipeline investment and substitution of oil flows from rail to pipe. Similarly, we find that policies enjoining pipeline construction would cause 80–90% of the displaced oil to flow by rail instead.