THE SENATE DID an odd thing the other day. With no hearings and no discussion in committee, it hastily took up legislation to rescue the sagging Farm Credit System by promising to put in federal money if needed -- or, more probably, as needed. Nobody really knows how much money that will take. Estimates vary, but it is likely to run to several billion dollars next year alone. Whatever the figure turns out to be, the Senate has now passed the bill. Odder still, that was exactly the right thing to do.

There wasn't any time to lose. The federal Farm Credit System, a gigantic structure of special banks and local associations, sells bonds to private investors and lends the money to farmers and ranchers. This month it will have to refinance about $11 billion worth of expiring bonds and, like everyone else, bond buyers have been reading about the system's bad debts and its soaring losses.

Without congressional action the bonds would have begun to be labeled risky, and the interest rates on them would have risen sharply. That would have increased the strains on both the system and its borrowers, resulting in further defaults and losses. The House Agriculture Committee, which got an earlier start and has moved through the normal procedures of hearings, reported a similar bill this week. Both versions would reorganize the system drastically, with stronger central control -- the Senate going farther here than the House committee.

Before any federal money is lent to the system, it will have to pool its separate banks' resources and exhaust them. That's a sore point within the system, for some of the district banks have adequate reserves while others are close to bankruptcy. But when those reserves are gone, the legislation tells the Treasury to buy as many of the system's bonds as necessary. While the money is a loan, it counts in the federal budget as spending -- pointing to the implications of a credit and banking crisis for the federal budget and the budget deficit. The troubles of the Farm Credit System are widely shared by the commercial banks that lend to agriculture.

One in the Senate to this bill is that it fails to deal with farm debt and farm credit generally. But Congress is setting an important precedent here. It is acknowledging the federal government's responsibility as the lender of last resort. Averting the collapse of financial institutions is usually expensive. But it is far less expensive than the alternative.