The new US oil boom that bulls think could bring the country to energy self-sufficiency is well-known. Less so is that, for many US producers, the boom has also been a crisis. If they are drilling in the hottest area of all, which is North Dakota’s Bakken Shale, their oil has often been left stranded, forcing a fire sale. In February 2012, Bakken producers had to offload their crude at a discount of $28 a barrel.

Now, the misery for producers appears to be nearing an end. One reason is that pipeline and railroad capacity is finally building up. But it’s also because the first new US refinery in almost four decades is being built in North Dakota.

In January, the Bakken shale produced 673,000 barrels of oil a day. That is up from 274,000 barrels a day in January 2011. Next January, it will soar to an estimated 850,000 barrels. Right now, North Dakota rails can handle only 660,000 barrels of oil a day, but by the end of 2013, Bakken producers will have a combination of 1.5 million barrels a day of pipeline and rail capacity, according to the US Energy Information Administration.

But it would also make sense to extract more value from that crude without it having to leave the state. Not least since, to get to the rail lines, more than half the crude is transported by diesel-burning truck. Those trucks, along with engines on oil rigs and the trains themselves, currently burn 53,000 barrels of diesel a day. Amid the plentiful crude, North Dakota has been importing almost all of that diesel.

For a long time, oil industry lobbyists have argued that dichotomies such as North Dakota’s have been created by environmental extremists and NIMBYs (or “not-in-my-backyarders”). They simply would not permit new refineries. Then the argument became that Washington should step in somehow because a loss of refining capacity is bad geostrategically.

The truth has been that new refineries have not been economically worthwhile. If they did, refinery executives have told me, they would have built more of them.

But the new North Dakota refinery—a small one in the town of Dickenson that its owners aim to be producing 8,000 barrels of diesel a day next year—shows a new reality in US oil. Built by two ultra-small players, MDU Resources and Calumet Specialty Products, the refinery has top-level political backing: Jack Dalrymple, the state governor, oversaw the groundbreaking in March. Three additional refineries are on the drawing board in the state. What makes them different, apart from the conveniently available supply of available crude oil, is their size, which does not require the normal enormous outlay of cash, and mobility—they can be moved should another locale, even very far away, prove more profitable.

The idea is to show other potential players that it can be done, and to satisfy North Dakota’s diesel demand at home. But if larger players see the economic logic, local refineries could make North Dakota and the surrounding states even richer.