Thousands of American homeowners may have innocently fallen into a federal tax trap last year by paying off their home loans in advance after being lured by large "discounts" offered by lenders.

Tax experts here say that a little-publicized ruling issued by the Internal Revenue Service late in 1982 is likely to have a severe financial impact on owners who thought they were getting bargains, but who now discover they owe $5,000 to $10,000 or more to the U.S. Treasury.

The IRS ruling affects all partial or complete home-loan payoffs made by borrowers in exchange for any form of reduction in principal debt from their lenders.

Many banks and savings and loan associations sent letters last year to mortgage customers with single-digit-rate loans. Even relatively small lending institutions sent out thousands of such letters because their portfolios bulged with low-yield mortgages. Nationwide, according to industry data, over $280 million worth of mortgages yielding under 10 percent are on the books of S&Ls alone.

In an effort to get rid of red-ink-producing mortgages like those, lenders proposed a wide variety of attractive "early payoff" deals to consumers. Among the most popular were plans that simply erased hefty chunks of debt in exchange for immediate payment of all or part of the remaining balance.

For example, a Pennsylvania S&L offered 5,400 of its customers up to 35 percent discounts--that is, erasure of one of every three dollars of principal owed--if they would pay off their mortgages in advance. Thus, on a loan with a $50,000 balance a customer would walk away with a debt-free home if he could scrape together $32,500. On a $30,000 loan, the figure would be $19,500. The immediate savings of $10,000 to $17,500, plus long-term savings of interest on the principal, attracted hundreds of customers.

Similar deals, some involving partial payoffs for lesser discounts, popped up across the country. The early-payoff plans became so widespread, in fact, that the S&L industry's trade magazine, Savings & Loan News, ran a "how-to-do-it" article last September.

What lenders and borrowers didn't factor into their plans was the IRS. In a ruling involving the lump-sum payoff of a homeowner's $20,000 loan for $18,000, the agency said the federal tax code requires that the $2,000 discount "savings" be treated as ordinary, fully taxable income to the property owner.

Any "discharge of indebtedness" must be considered income under the tax code, unless the homeowner is bankrupt, insolvent or paying off a business debt, the IRS said.

The IRS's ruling was retroactive and, thus, affects thousands of people who signed up for discount payoff plans during 1982 and before, as well as those involved in them this year.

"It's really a time bomb ticking away for some consumers who haven't the slightest idea about it," warns Robert D. Milburn, the national real-estate tax-services head of the accounting firm Laventhol & Horwath.

When you figure in the tax liabilities--plus the possible penalties after an audit--"some people could be hit very hard by this," according to Milburn.

The homeowners who "saved" 35 percent, or $17,500, on the Pennsylvania payoff plan could be liable for back taxes of nearly $9,000 if they're in the 50 percent tax bracket. The owner who "saved" $10,000 might have to hand over a sizable chunk of it to the federal government--an event he probably never dreamed.

Those homeowners who borrowed money in order to make the lump-sum payment will be in even worse shape: They'll owe taxes for "income" they never had in their wallets, plus be liable to creditors for repayment of what they borrowed.

Most consumers weren't warned that there were potential tax consequences to the discount-mortgage plans because lenders themselves weren't aware of the problem until it was too late, according to savings and loan executives.

"We never mentioned taxes in our promotional letters," says Thomas Sautoff, vice president of Midland Federal S&L of Denver, "because we weren't advised" of the problem until late 1982. About 150 homeowner customers of Midland took advantage of the S&L's discount-payoff plan last year, according to Sautoff.

"If we were sending out new letters today," he adds, "naturally we'd make reference to the tax issue."

At least one congressman, Rep. Barney Frank (D-Mass.), is upset enough about the ramifications of the IRS ruling for both consumers and lending institutions that he has just introduced a bill to amend the federal tax code to allow early-mortgage payoffs without taxation of the imputed gain to the homeowner.

Frank's bill, HR 1293, may not help consumers who fell into the tax trap in 1982, says an aide, "but it would certainly help people stay out of it in 1983."