There's LOTS of reasons, not ALL of them good.
One - North Dakota is hell for the severely unemployed - you simply CANNOT live there without money, housing, etc. The climate won't allow it. VERY different than either coast, except perhaps New England. So if you don't find work, you leave or die. Even in the Depression, hobos had the sense to not get trapped up north except during harvest season.
Two - their response to the weather: "The state's weather makes it hard to lure new residents. The average January low temperature is four degrees below zero. North Dakota holds job fairs in other states to match workers to available jobs.
Three - "North Dakota is one of the few states to add manufacturing jobs over the decade. Bobcat, maker of farm and construction equipment, is headquartered in the state. We don't have big factories like Gary, Ind., or steel mills that are hard to retool," Flynn says. "We have smaller plants that are some of the most efficient in the world."
Four - "Access to credit is the enabling factor that has fostered both a boom in oil and record profits from agriculture in North Dakota. The Bank of North Dakota (BND) does not compete with local banks but partners with them, helping with capital and liquidity requirements... North Dakota’s money and banking reserves are being kept within the state and invested there... In contrast, California is the largest state economy in the nation, yet without a state-owned bank, is unable to steer hundreds of billions of dollars in state revenues into productive investment within the state. Instead, California deposits its many billions in tax revenues in large private banks which often lend the funds out-of-state, invest them in speculative trading strategies (including derivative bets against the state’s own bonds), and do not remit any of their earnings back to the state treasury."
And the fact that the Right is running with the idea that
http://www.politifact.com/truth-o-meter/statements/2010/oct/29/crossroads-gps/crossroads-gps-says-north-dakotas-economy-reeling-/">North Dakota's economy is in shambles indicates it probably really is doing as well as it appears.
Their magic trick appears to not be a magic trick at all, unless you count "don't do anything both large-scale and incredibly stupid" as a magic trick. It remains to be seen how much fracking will cost them, but they're so lightly populated that they could destroy a hell of a lot of water before it was seriously noticed. Fracking might just turn out to qualify as "both large-scale and incredibly stupid".