Severe winter weather, shale oil, and bumper harvests of crops such as wheat, barley, oats, and soy have all combined to slow down the operator of North America's second largest rail freight network. The network is of course Berkshire Hathaway's Burlington Northern Santa Fe Railroad (BNSF). Congestion has also affected Canadian National Railway (NYSE:CNI), which, along with BNSF, transports most of Bakken's crude oil from North Dakota to the rest of the continent.

The problem is that even before the 2008 economic downturn, these railway networks were already facing severe congestion problems that were exacerbated by crumbling road beds, ancient switch yards and loading depots, and lackluster investor interest. Now with light tight oil shipments clogging the network, even crops and new cars are having a tough time getting to market.

Is there profit in congestion?

Crowding out
Canadian grains are typically shipped by rail. In Canada, all field crops saw a harvest of over 20% larger than 2012. Bean oils, such as soy and canola, are up 27%. A similar result was posted by U.S. farmers. This is a terrific harvest given a late seeding and start on the growing season. More hectares were seeded with a greater yield this past year.

The outlook is much the same for 2014 bolstered by stronger world demand for exports. Canadian farmers are further motivated by a Canadian dollar that continues to be weak by about 10% against the U.S. dollar. All crops are priced in U.S. dollars. The Canadian farmer would get more Canadian dollars for every U.S. dollar of crop sales.

So how does the farmer get grain to market? By rail of course, or truck if necessary -- certainly not by pipeline. Grain elevators are at capacity as oil takes over the rails. Supply constraints will only raise the all-in price of grain and ultimately of food.

Shippers will see boom-time profits whatever they transport, while farmers will continue to see price volatility at the elevator. It would take about 400 truckloads to replace a 110 unit grain train. Even those 400 trucks are taken over by excess demand for the more lucrative crude shipments.

Slow going
More congestion is just a symptom of more business for the railways. Would this imply that they are at capacity? Not necessarily. Canada Pacific's average train speed has slowed to about 24 miles per hour, slower by 13% year on year. BNSF is crawling at an average speed of about 20 miles per hour, almost 20% slower than the previous year. Coal and grain unit trains are the slowest of all. Time spent "dwelling" in terminal yards is also up, as are the number of railroad cars on tracks. Union Pacific (NYSE:UNP) and CSX (NASDAQ:CSX) tell similar stories.

With the Lac Megantic disaster in Quebec and 47 dead in July 2013, rail safety continues to shift to derailments and tank car standards. Among the Bakken railroads, only Union Pacific reports an increase in the number of derailments. BNSF and Canada National both saw lower numbers of derailments over the past three years.

So it would appear that the railway networks are not necessarily at capacity. In fact, with safety paramount in regulators' minds, more capital might be required, which would in turn eat into profits.

Not just the number matters
The real story for investors in railroads is what trains carry, however. From the Dakotas they carry light tight crude, a more highly flammable liquid than many other grades of crude. BNSF just experienced two derailments, one of which saw exploding tank cars in Casselton, North Dakota.

The National Transportation Safety Board issued its preliminary findings that detail the $6.1 million worth of damage when the grain and petroleum unit trains collided. The DOT-111 tank cars spilled about 400,000 gallons of light tight crude oil. Both trains were going well under the speed limit of 60 miles per hour. Fortunately, no one was injured. Congestion on the rails also means more wear and tear, which also means more accidents.

New DOT-111 tank cars will be built to handle the increased pressures of crude oil with dissolved natural gas. Both the Lac Megantic and Casselton derailments involved outdated DOT-111 tank cars. Over $1 billion is estimated to retrofit DOT-111 to current standards. In the end, no one is certain that any standard would stop a derailment from producing a fireball. The primary way to ensure tank car safety is to be sure trains stay on the track in the first place.

The other way to ensure crude transport safety is to build pipelines. The XL Keystone pipeline is under attack by many activist groups that call an end to further fossil fuel development. Further delays in pipeline construction on the northern Canadian leg across the border of the U.S. will mean more reliance on a brittle railroad network already congested with committed grain and coal shipments.

In the end, a Fool
This winter keeps holding on with record cold snaps and congestion just from the weather. Bakken production continues unabated. Trains will derail; it is not a matter of if, but of when. Pipeline construction continues to mire in a fossil fuel to the death debate.

Two very positive things can come from all of this. First, railway shipping profits are being forced into building a much more resilient transportation network than we had before 2008. Second, however the pipeline/fossil fuel debate shapes itself, political will seems to favor infrastructure investment.

Investors should be happier in the long run as better infrastructure will help insulate future profits from the financial impact of potential railway negligence. Infrastructure investment will also help reduce the possibility that families lose loved ones.

Bill Foote has no position in any stocks mentioned. The Motley Fool recommends Canadian National Railway. The Motley Fool owns shares of CSX. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.