They call it "Home Sweet Home." But battle lines are forming over who pays the costs when a house buyer is bilked.

Today every state has some sort of consumer protection law, and in some states these laws affect real estate transactions. As a result three camps are forming:

Aggrieved home buyers around the country, armed with new legal backing, who are an 'I'll sue" frame of mind.

Real estate brokers who are busy rewording standard purchase-and-sale agreement forms to protect themselves against proliferating lawsuits.

And home inspectors, a new professional group that offers would-be buyers advice about the soundness of the house they're considering, who are taking on new importance and offering new kinds of service -- including insurance.

What all three groups hope to avoid is shown in the experience of a couple who moved recently to Andover, Mass. Soon after buying a 15-year-old house in a good neighborhood, they began to discover defects.

One day, as the wife stepped out onto a secondstory porch, she leaned lightly against a wooden railing. It instantly gave way, falling to the ground. She caught her balance just in time and escaped the 10-foot drop.

There was no sharp crack or splintering sound, because, she discovered, the railing was so rotten it could be squeezed like a sponge. The soft brown rot had been covered with a coat of sparkling white paint. A closer look revealed more rotten places in the wooden stairs down to the backyard, hidden under shiny paint.

There were other unpleasant surprises.

The husband traced an offensive odor to a corner of the garage that had been piled with the seller's possessions when the buyers first saw the house. The new owners found that a plastic bucket had been placed under a drainpipe leading to the septic tank to catch a steady drip. Obviously something was wrong with the system.

Last August when the couple was looking over the house before they bought it, they turned on the furnace for nearly half an hour to be sure it was working. But now that the weather has turned chilly they are dismayed to discover that the heating system for the lower floor sizzles, froths and cuts out after 20 minutes without bringing the temperature up to the desired level.

Half the jalousie windows were stuck -- some open, some closed. The built-in dish washer leaves puddles on the floor. And instead of the 12 inches of attic insulation the buyers thought they were getting, there is only six inches.

It was not until after the sale that the couple learned that a week before they made their bid the owner was under investigation by authorities. The real estate salesman did not mention that fact. Later the owner was indicted on charges of grand larceny.

The sunny side of this episode is that it took place in Massachusetts, which has an especially tough consumer protection law that could be a trend-setter for the rest of the country. These buyers, therefore, can hope to recover at least some of their losses. They have hired an attorney.

The Massachusetts law, passed 11 years ago, is broad. It simply says that "unfair and deceptive practices in the conduct of trade or commerce are illegal in Massachusetts."

It applies to the sale of real property. But the Massachusetts Supreme Judicial Court has ruled that it does not apply to private sales between owners and buyers where no brokers are involved.

In the biggest case so far under the law, a subsidiary of a large Los Angeles-based firm has agreed to repair or buy back 65 condominiums in Amesbury, Mass., from purchasers who complain of shoddy workmanship. It cost the firm $1.5 million.

It has taken the public quite a while to recognize its newly defined rights under the law, says Richard A. Gross, chief of the Consumer Protection Division of the Massachusetts attorney-general's office. But now "the entire home buying and selling industry is beginning to feel pressure from buyers and from this office," he said.

Today home buyers are sending his office a steady flow of complaints. He has nearly 200 cases on file, six of which have gone to court.

Real estate people, understandably, are not so enthusiastice. Stuart Carroll, chairman of the Massachusetts Association of Realtors, says his group feels the state consumer protection law is inequitable in some instances.

The association is recommending two major changes to its members:

That they obtain a written statement from the seller that all information in the broker's listing of the property (which describes the condition of the house) is accurate and may be disclosed to the prospective buyer. "If the roof leaks, we want the seller to tell us and we want to be able to tell the buyer," Carroll stressed. "We do not want to be held responsible for it.

That a buyer be given 10 days after acceptance of his offer to have a consultant of his own choosing inspect the premises (at the buyer's expense).