The competition for record sales prices in the art world got out of hand here this week with widespread reports that Britain's National Gallery had paid a record $7 million to $12 million for a rare German Old Master painting.

Experts agree that the painting, "Christ Taking Leave of His Mother" by the early 16th-century Bavarian painter Albrecht Altdorfer, likely would have sold at auction for far more than the record $6.4 million paid for J.M.W. Turner's "Juliet and Her Nurse" at an auction last summer at Sotheby's in New York.

But the National Gallery actually paid somewhat less than that record price when it bought the Altdorfer painting in a private transaction arranged by Christie's here. The deal for a cash amount well below the painting's estimated value was designed to keep the art work in Britain and enable its sellers, the heirs to an important private art collection, to avoid heavy taxes and save the rest of the collection.

To protect the confidentiality of the deal, no one involved would disclose the actual amount paid. This left the price open to confused speculation when Christie's claimed that the Altdorfer's estimated value for negotiation and tax purposes made it the most valuable painting to change hands in any transaction to date, a rather nebulous sort of record.

A reconstruction of the deal from well-informed sources here illustrates the pitfalls of such record claims, the dizzying inflationary spiral of art prices, the international competition for rare Old Masters and the impact of tax laws on dwindling private art collections here.

The Aldorfer painting, one of only two by him known to be in Britain, was the most important work in an unusually varied art collection gathered around the turn of the century by a British diamond millionaire, Sir Julius Wernher.

When Lady Zia Wernher died in 1977, a number of relatives inherited the collection, housed at Luton Hoo, an imposing mansion on a 1,500-acre, 18th-century estate north of London. The heirs could not afford to maintain it all, and they did not want to have the estate broken up and sold off, as the famous Mentmore estate was a few years ago.

So the Wernher family decided to sell a valuable masterpiece from the collection and put the proceeds into a charitable trust, whose income would be used solely to maintain Luton Hoo and the rest of its treasures. Experts estimated that a trust of $3 million or more was needed.

If the Altdorfer masterpiece had been auctioned off or sold to any private or foreign buyer, the Wernher family would have lost more than half the sales price in taxes and fees. But British tax law gives special treatment to anyone selling an art work "of major national importance" to a collection owned by the British government. The seller can collect the equivalent of the estimated after-tax receipts that would have been produced by an auction plus a quarter of what would have been paid to the government in tax.

For the purpose of these calculations, the Wernher estate's Altdorfer painting was given an estimated auction value through "sheer speculation" by art experts, according to well-informed sources, of nearly $12 million -- almost double the record price paid at auction for Turner's "Juliet and Her Nurse." The sources said this high figure was justified by strong foreign demand for the painting, especially in West Germany, which has been seeking to regain German masterpieces, and in the United States, where there is now nothing by Altdorfer, one of a small group of important, innovative German artists of his period.

In negotiations conducted for the Wernher family by a Christie's expert with the director of the National Gallery, the British government agreed to pay about $5 million for the painting, according to these sources. Most of the money came from the government's new National Heritage Fund, begun in April to "save for the nation" art treasures being sold by private collectors, and several private charitable trusts, assembled with the help of Britain's arts minister, Norman St. John-Stevas.

Christie's announced the sale and made its claim about the painting's record "fair market value," which was erroneously converted into a record sales price by the British press, including The Times of London and the Financial Times, and repeated by news services in newspapers around the world.

These reports of a sales price double or more what the National Gallery actually paid uupset some of its officials, who feared the speculation could further inflate the prices of other paintings it seeks in the future. The Altdorfer masterpiece went on display yesterday at the gallery on Trafalgar Square.