When President Reagan agreed last week to impose severely restrictive quotas on sugar imports, driving up domestic prices, it was a case of a raw political deal coming back to haunt him--and American consumers.

In addition to taking from $1.5 billion to $3 billion out of consumer pocketbooks by boosting sugar prices here a minimum of 5 cents or as much as 10 cents a pound, quotas make a farce out of the administration pretense that it believes in free trade and free markets.

Consumers will pay the price for this outrageous protective measure not only in the cost of sugar itself, but also for soft-drinks, candy and other foods using sugar.

And what an embarrassment for Reagan and his highly publicized Caribbean Basin initiative, which was supposed, among other things, to allow Caribbean countries to export sugar here duty-free! Quotas obviously would take away with one hand what was to be given with the other. And if quotas are adjusted for the Caribbean countries to maintain their traditional market shares, other exporters will have to be squeezed even more.

Sugar quotas, also, hardly make the administration trade hawks look good as they pressure Japan to drop quantity limits on imports of beef, citrus and other agricultural commodities.

Reagan got himself into this mess when he agreed not to oppose sugar price supports in order to button up three or four Southern state votes in Congress for his budget reconciliation bill last year. He was warned then that it could be costly--but his single-minded focus was on driving his budget through Congress.

In his award-winning Atlantic Monthly article on "The Education of David Stockman," writer William Greider reported how Stockman, for those few votes, "casually" traded a promise that the president would not oppose revival of a scandalous sugar price-support loan program that had been killed by Congress in 1979:

" 'In economic principle, it's kind of a rotten idea,' Stockman continued. Did Ronald Reagan's White House object? 'They don't care, over in the White House. They want to win.' " In the same time frame, Reagan reversed his opposition to peanut price-support legislation to pick up five votes, four from the peanut state of Georgia.

As Greider wrote, Stockman was a willing participant in this open barter for votes. When the sugar deal was offered to him by a Southern congressman, he ran it past the White House: when they didn't say "no," Stockman sacrificed principle for votes. He and Agriculture Secretary John R. Block even put the peanut deal in writing.

" . . . as the final balance was being struck," Greider wrote, Stockman "was forced to concede in private that the claim of equity in shrinking the government was significantly compromised if not obliterated."

This is dramatically highlighted by new sugar quotas, which simply transfer the burden of protecting domestic sugar interests to consumers from the government, making a mockery of the Reagan propaganda line that he is "getting the government off your backs."

The specific White-House congressional deal on sugar, passed last December, in effect guarantees American producers a price of 17 cents a pound--nearly twice the current glut-induced world market price of 9 cents.

Adding in duties and fees of 6.8 cents, plus the cost of shipping and insurance, the imported price works out to about 18 cents--which sets the market price here. Domestic producers claim they're losing money, and unless they can get 20 to 21 cents a pound, they'll exercise their right to force the government to lend them 17 cents a pound, and then forfeit the sugar to Uncle Sam. That could cost the federal treasury $800 million in fiscal 1983.

So Reagan turned to quotas as a way of boosting prices to 20 cents or more, allowing domestic producers to sell their sugar to consuming industries and individuals, rather than sticking Uncle Sam with it. For every dollar thus saved the budget, it appears consumers will have to shell out a minimum of $2.

Defensively, Secretary Block said that quotas were "necessary to avoid a massive flow of sugar imports into the United States, which would disrupt the commercial market for domestically produced sugar and would cause large quantities of domestic sugar to move into government ownership."

What Block failed to say was that regardless of the sugar glut, the administration would not have had to impose quotas now if it hadn't abandoned its own free-trade principles last year by agreeing to support prices. As Reagan or Stockman should have learned from the Faust legend, a bilateral pact with the devil has a costly payment in the end.