I am not a Ted Cruz fan and can't imagine ever voting for a man so vainglorious. But the junior senator from Texas pulled off a rather remarkable feat in Iowa this week: Not only did he come from behind and win the Republican caucus, but he did so despite dissing the Hawkeye State's beloved ethanol fuel mandate. No candidate — Republican

or Democrat — had touched this senseless boondoggle and lived to tell the tale.

But was this a freak stunt by a freak politician that can't be replicated? Nyet! Cruz's campaign offers some lessons to politicians wishing to take a principled stand against welfare for powerful lobbies — what he time and again refers to as the "Washington cartel."

Iowa, an agricultural state, has been hooked on federal ethanol largesse since 1980 when Congress first started subsidizing it. Although this subsidy ended in 2011, Iowa's addiction only grew because Congress passed the Renewable Fuel Standard mandate in 2005 requiring refineries to mix ethanol, which is produced from corn, into gasoline in order to cut greenhouse gases and promote energy independence.

Since then, a pledge of allegiance to King Corn has become a rite of passage for any candidate serious about winning the Iowa caucus, never mind that ethanol doesn't meaningfully cut greenhouse gases. It also raises fuel and food prices (by diverting farmland from fruits and vegetables to corn) and gums up cars.

Indeed, as my Reason colleague Jacob Sullum points out, since 1980, all the Iowa primary winners in both parties have been ethanol boosters. Republican Sen. John McCain's opposition to ethanol subsidies in the 2008 elections made his candidacy in the state so unviable that he simply stopped campaigning, finishing fourth and handing the contest to former Arkansas Gov. Mike Huckabee, who supported the subsidy. Meanwhile, on the Democratic side, President Barack Obama pilloried Hillary Clinton's ethanol flip-flop (she was against it before she was for it), and declared ethanol production a national security issue.

Likewise, in this election, on the Democratic side, both Clinton and Bernie Sanders, the fearless crusader against crony capitalism, promised even more federal support for Iowa's biofuel industry. Among Republicans, Trump out-pandered all his rivals. "I love ethanol," he declared, vowing to jack up the EPA's ethanol mandate. The only exceptions were Kentucky Sen. Rand Paul, who has since suspended his presidential bid after placing fifth in the caucus, and Cruz.

Cruz stuck to his guns, despite frontal attacks not only by his rivals but also Iowa's Republican Gov. Terry Branstad — who took the unprecedented step of warning Iowans that since Cruz doesn't support ethanol, it would be a mistake to support him.

But Cruz (rightly) insisted that it was not the government's job to pick "winners and losers" in the marketplace, especially by forcing drivers to pay more at the pump.

He offered his own free market plan to boost ethanol by eliminating EPA's "blend wall" that had artificially kept the amount of ethanol being blended in gas to below 10 percent, he maintained. Knocking it down, while eliminating all the subsidies that Big Oil enjoyed, he said, would expand ethanol's market.

But with oil prices plunging due to the fracking revolution, it is hard to see how ethanol could effectively compete without subsidies and it is unlikely that Iowans were fooled.

So how did Cruz win them over? By putting together a shrewd electoral strategy that thwarted what political scientists call the "public choice" dynamic.

Under this dynamic, policies whose benefits go to a small group but whose costs are dispersed across a large population are hard to undo even when the net costs are greater than the net benefits. Why? Because the beneficiaries have every incentive to mobilize — lobby candidates, influence the media, go the polls — on behalf of the policy. However, ordinary folks don't have an equal incentive to oppose it because the cost to them is too small to be worth the effort. This problem is even more pronounced in a caucus state like Iowa where voting is not just a simple matter of pulling a lever but an evening-long commitment.

But Cruz got his supporters to make the schlep on his behalf not by talking them into an anti-ethanol revolt. (A Des Moines Register survey just before the election found that 42 percent of Iowans disagreed with Cruz on ethanol, 37 percent agreed and the rest were undecided, hardly an electorate champing at the bit to send Big Ethanol a message.) Rather, Cruz assembled a broad but piecemeal coalition of conservative voters by giving each faction something it really, really cared about. He wasn't like McCain, the other anti-ethanol Republican, who threw down the gauntlet to voters and basically told them to take it or leave it.

Cruz's anti-ethanol stance appealed to his core Tea Party, anti-establishment base that saw it as part of his courageous commitment to limited-government, fiscal restraint, and free market principles. But the far bigger factor in Iowa politics are evangelicals — some of them are probably sympathetic to ethanol and some are not.

Cruz appealed to them by playing up his Christian roots — and the story of his dad's redemption, an alcoholic-turned-pastor. His speeches were infused with Biblical references. Just as he convinced Tea Party conservatives that his policy positions seamlessly stemmed from his limited government ideology, he persuaded evangelicals that his policy commitments and religious convictions were coextensive.

These commitments included an unflinching opposition to a gay agenda and abortion rights. In fact, he condemned the Supreme Court's Obergefell ruling legalizing gay marriage as the "very definition of tyranny" and pledged to return the issue to states — a very clever way of uniting both the Tea Party and evangelical Iowans. His little jeremiad against Trump's New York values may have appalled pundits. But it instantly concretized for Iowa's traditional voters the stark contrast between what they stood for — and a creepy playboy who had once said that had Ivanka not been his daughter, he'd date her because "she had a very nice figure."

The upshot was that instead of Trump bringing new voters to the polls as had been widely predicted, Cruz did, expanding the evangelical share of the electorate from 57 percent in 2008 to 64 percent this time. And he pulled 34 percent of this vote, 13 points more than Rubio, his closest rival. What's more, of the folks who voted for candidates based on "shared values," Cruz pulled 17 points more than Rubio, who got the second highest votes from this group.

But Cruz reached out not just to traditional religious voters but also nationalist conservatives worried about security. He backed off not even slightly from his anti-immigrant screeds, pledging to kill any form of legalization for undocumented aliens and building a wall to secure the border. And he dialed up the saber rattling against ISIS, promising to bomb it till the "sand glows."

Much of Cruz's agenda is nasty, unlovely stuff playing on people's fears and demonizing his opponents. Ronald Reagan's sunny and uplifting optimism it is not.

But its genius is that it shows a way to take on powerful special interest groups and dismantle the edifice of crony capitalism that is corroding trust in this country's institutions. There is no reason why a more enlightened conservative can't apply the same formula to appeal to the better angels of Republican voters.

This column originally appeared in The Week