At first glance it looks like a flawless mortgage magic trick: Home buyers get below-market rate loans, depressed housing markets brighten, it costs little or nothing to local governments and builders, and no new federal spending is needed.

Only the Treasury Department for years has been the spoilsport insisting that the program--tax-exempt mortgage revenue bonds--is magic done with mirrors. The loss of tax dollars is the equivalent of federal spending, but more of the benefits go to high-income bond holders than to the first-time home buyer the bonds are targeted to serve, tax and budget experts say.

But the bonds have been enormously popular with local housing authorities and have been used in the Washington area to provide low-rate funds for thousands of home buyers in the last few years.

Despite Treasury's contention that mortgage bonds are an inefficient form of interest rate subsidy, the Reagan administration now wants to broaden the program, to the potential delight of the local governments and the housing industry.

The administration already has announced regulatory changes that it estimates will enable funding for about 50,000 homes. This has been labeled "too little, too late" by the National Association of Home Builders, and at least one local housing official says it is merely a Band-Aid on problems besetting the current program. But if the bond program were opened up substantially, as is still being considered by the administration, the industry believes it could provide funding for up to 500,000 home buyers.

Many of the president's advisers, searching for a cheap way to give the housing industry a short-term boost, have been fascinated by the budgetary disappearing act the mortgage revenue bonds have performed. So few bonds were sold last year, because of federal restrictions and the ailing bond market, that there already are enough funds in the budget to accommodate a much expanded program.

The nation's realtors, home builders and state housing agencies want legislation to broaden the program by cutting out numerous restrictions imposed by Congress in 1980.

The Council of State Housing Agencies, one of the biggest boosters of the idea, last fall said the budget would accommodate a program to provide $10 billion in loans to about 180,000 home buyers with budgeted funds of $300 million.

That works out to a federal cost of $1,666 per assisted home buyer.

This high cost per beneficiary was what led to criticism of the program even after it was severely restricted.

"It is a program with a 200 percent overhead, financed by a Treasury that has no money for such a program in the first place," wrote Rep. Andy Jacobs (D-Ind.) in 1979 in a Ways and Means Committee report. "Who else but Uncle Sam would drive interest rates sky high by borrowing $2 billion in order to give $1.6 billion to middlemen and the residue of only $633 million to a few first-time home buyers for a modest reduction in those sky-high interest rates? . . .with the tax-free mortgage bond program, the government is trying to cure the harmful results of its over-borrowing by engaging in more of the same, a classic case of opiate economics." The use of the bond program in the Washington area was among the highest in the country last year, with the Montgomery County Housing Opportunities Commission and the Virginia Housing Development Authority in the top 10 of those issuing bonds in 1981, just before new rules went into effect.

Montgomery County officials, in fact, say the program will be directly responsible for one-third of all the housing starts in the county this year by financing 1,300 mortgages. Their December bond issue was for $75 million, and almost all of it is expected to be used for new homes. This has resulted in an increase in housing construction in Montgomery County at a time when starts are dropping precipitously throughout the country, officials say.

The Virginia Housing Authority issued a $100 million bond in December, enough to finance 1,700 mortgages at 13.7 percent with net proceeds of $85.2 million after fees.

"We are the only source of affordable funds for the first-time home buyer," said VHDA spokeswoman Anne Clayton. The bonds have been used to finance more than 20,000 loans since 1974, she said.

At the same time, the authorities say they won't be able to continue to do this unless the federal government loosens restrictions that make the local governments share in the cost of the program.

Until 1980, when Congress put restrictions on the program, the local governments didn't have to put up any of their own funds for the bond program. They could provide mortgages at one to two percentage points below market rates because of the federal tax exemption on the interest on the bonds.

High interest rates, the problem the program is designed to counteract, also had the effect of making the program a flop last year.

A recent Congressional Budget Office analysis of the mortgage revenue bond program explains: "Since high interest rates on bonds necessitate high interest rates on mortgages financed with bond proceeds, the mortgage interest rates offered by programs offered in 1981 had to be higher than those previously charged. Only a small group of borrowers could (or would) pay the higher rates and had income high enough to meet the lender's qualifications for the high-rate mortgages but low enough to meet the program income limits."

The interest rates virtually ended the use of the mortgage revenue bond device for another kind of housing program, low-income rental housing, which is in critically short supply in some parts of the country.

"Many developers have delayed plans for new apartment buildings because interest rates on tax-exempt bonds are so high that the projects would be unprofitable," the CBO analysis said. A "requirement that 20 percent of the units be rented to low-income tenants aggravates that situation somewhat, because it reduces the income that owners can expect to receive from the buildings," the anaslysis said.

It is the federal tax exemption on the interest that makes the bonds attractive to investors despite the relatively low interest rate the state or local government pays to borrow the money. For example, if a taxpayer is in a 50 percent marginal tax bracket and gets a tax-exempt 8 percent yield from the bond, is the same as if he got a 16 percent taxable yield on another investment. If the state can borrow at 8 percent, even after administrative costs, it can lend to home buyers at only a couple of percentage points higher than that and still break even.

Only the federal government then loses money on uncollected tax revenues.

This program was available virtually without restriction for years, but only at the end of the 1970s did state and local governments start using it widely.

Eventually there were abuses--stories of luxury condominiums in California being financed with the tax-exempt funding intended to be used for public purposes. Some cities, particularly Chicago, were issuing them in large-scale numbers, while some housing authorities weren't geared up to issue any at all. The benefits, it was said, were going to a select few while the federal treasury was drained of revenue loss from the high-income bond holders.

In 1979 then Ways and Means chairman Al Ullman (D-Ore.) and ranking minority member Barber Conable (R-N.Y.), with the active support of the Carter administration, proposed legislation to prohibit the use of mortgage revenue bonds entirely, evoking an outcry and standing-room-only crowds in the spacious Ways and Means hearing room of state and local government representatives.

In the end, the 1980 legislation severely restricted the use of the bonds until the end of 1983, when the legislation is scheduled to expire. The program now is available only for first-time home buyers, and each state is limited to the amount of bonds they can issue--either $200 million or 9 percent of an average amount of mortgages issued in the state, whichever is higher.

In addition, the law limits the spread between the amount of interest paid to the bond holder and the amount given to home buyers in an attempt to make sure that as much of the benefits as possible go to buyers. This has meant that local governments now subsidize part of the program because the spread is not large enough for them to break even. The administration wants to keep it that way even while loosening some of the restrictions.

"We see the regulations changes as putting a Band Aid on the problem," the VHDA's Clayton said.

The National Association of Realtors strongly supports a much broader program that it believes could be added to a bill being considered in a congressional conference committee, which includes minor changes in the current revenue bond program.

The administration is still looking at the possibility of supporting legislation to further broaden the mortgage revenue bond program.