When Treasury Secretary Robert E. Rubin and Federal Reserve Board Chairman Alan Greenspan went to Congress in January asking approval for a $40 billion, U.S.-led bailout for Mexico, several Republican lawmakers offered what they thought was a better idea: Rather than risk a messy political brawl, why not tap the Exchange Stabilization Fund, a little-known Treasury Department reserve over which Rubin had almost sole control?

At a late-afternoon meeting in the office of House Speaker Newt Gingrich (R-Ga.), Rubin, Greenspan and Treasury Undersecretary Lawrence H. Summers dismissed the suggestion as impossible, participants recall.

But three weeks later, with its bailout proposal mired on Capitol Hill and the Mexican government hurtling toward bankruptcy, the administration abruptly changed its view.

On Jan. 31, President Clinton announced he was extending the Mexican government an unprecedented $20 billion in loans and loan guarantees -- some of them for as long as 10 years -- by drawing on the very Exchange Stabilization Fund (ESF) Rubin had said could not be used.

Now lawmakers are calling for hearings over whether the administration's use of the obscure Treasury fund violates the law. The Exchange Stabilization Fund "is not the president's personal piggy bank," Senate Banking Committee Chairman Alfonse M. D'Amato (R-N.Y.) thundered in a Senate speech last week.

On that January afternoon and in subsequent discussions, Rubin, Greenspan and Summers argued that using the fund would stretch the limits of the law and precedent, participants recall. The fund's primary purpose, they said, was for short-term currency transactions to bolster the dollar -- not to rescue cash-strapped foreign governments. In any case, they calculated the $25 billion fund was too small to address Mexico's problem by itself.

But as events unfolded, administration officials reconsidered. A last-minute $18 billion offer from the International Monetary Fund, along with the money in the ESF, provided the credit administration officials deemed necessary to stabilize the peso.

"They needed a way out . . . " a House Republican involved in the discussions said of the change. "They obviously looked at the ESF at the outset and said, There's no way.' But when pressed, they went back and said, We haven't been sufficiently creative in our interpretation of the law.' "

The night before Clinton announced the new rescue plan, Gingrich, House Banking Committee Chairman Jim Leach (R-Iowa), Senate Majority Whip Trent Lott (R-Miss.) and Sen. Robert F. Bennett (R-Utah) met and agreed that the administration's bailout plan was in deep trouble. One of the lawmakers telephoned Rubin and raised use of the fund again, according to Treasury and congressional sources.

Rubin said Greenspan and others had advised him it would be politically unwise to tap the fund without congressional approval. "What if I told you that no one in Congress is going to complain?" the lawmaker asked.

"That would change things entirely," Rubin replied, the sources said.

But now, members of Congress are complaining. D'Amato has vowed to make the fund's legal status a focus of hearings later this month.

Last night, a Treasury Department official lamented that "many members of Congress are now criticizing us for what {other} members asked us to do" earlier.

Most of the past fund loans to foreign governments have been for less than $1 billion. The 1934 law establishing the fund restricts loans to foreign governments to six months unless the president "gives Congress a written statement that unique or emergency circumstances require the loan or credit be for more than six months."

Clinton has deemed the Mexican case an emergency, arguing the Latin nation has broad commercial and social links to the United States and a Mexican default might have triggered a global financial meltdown.

Many legal experts doubt opponents could overturn the administration's decision to lend ESF money to Mexico on strictly legal grounds. The fund is "under the exclusive control of the secretary," the statute states, adding, "decisions of the secretary are final and may not be reviewed by another officer or employee of the government."

That is not likely to silence congressional critics. D'Amato is likely to use hearings to question whether the funds for Mexico are really foreign aid -- a use expressly prohibited by law.

In a 14-page brief to D'Amato's committee, Treasury Department General Counsel Edward S. Knight said, "Treasury has taken steps to assure that there is a source of repayment" of the Mexican loans. But the lending agreement Rubin signed with Mexico's government last week describes the Mexican oil proceeds that secure the U.S. loans as "assured sources of repayment" rather than collateral -- an artful turn of phrase opponents say reflects the shakiness of U.S. claims on Mexico should the country fail to repay its debts. Last week, Senate Majority Leader Robert J. Dole (R-Kan.), who initially endorsed the use of the ESF, expressed concern about using the fund to prop up the Mexican banking system. "The Treasury Department needs to be very careful in the use of funds from the Exchange Stabilization Fund," Dole said in a statement. "I am not convinced that thrusting the United States into the middle of a Mexican banking crisis is prudent or necessary."

CAPTION: WHAT IS THE ESF? * Name: Exchange Stabilization Fund * Affiliation: Part of the Treasury Department * History: Founded in 1934 under the Gold Reserve Act. Initial funding was $2 billion. * Purpose: Initially, to stabilize the dollar's exchange value. Currently, it is used to intervene in foreign exchange markets and to make short-term loans to developed and developing countries. * Financing: Current reserves are $25 billion. No money has been added since 1934; the fund has grown through interest and investments. A SAMPLE OF ESF LOANS

An examination of ESF financing agreements shows Mexico, Argentina and Brazil have borrowed the most from 1980 through June 1994. Country............... Amount lent Mexico.............. $3.2 billion Argentina ........... 2.2 billion Brazil............... 2.1 billion Peru..................470 million Jamaica................50 million Yugoslavia.............50 million Nigeria................37 million Hungary................20 million SOURCE: Congressional Research Service A