In an old garbage dump just outside Chicago, buried amid orange peels and coffee grounds and covered by yellowing crabgrass, lies an important lesson in the workings of the U.S. tax code.

About 30 years ago, the dump was a massive clay pit. The old Illinois Brick Co. bought it and dug out the clay. In so doing, it claimed one of the nation's most hallowed, and also most vilified, tax write-offs: the "depletion allowance," which allows owners of natural resources to take deductions as the resources are used up.

In 1952, garbage-dump contractor John Sexton bought the depleted clay pit and filled it with trash. Sexton, too, claimed a depletion allowance. He said he was using up the most valuable resource a dump operator could buy -- a hole in the ground.

The U.S. Tax Court upheld Sexton's deductions, while calling them by another name: depreciation. This was less lucrative than mining depletion, but tax attorney Sheldon Cohen, then commissioner of Internal Revenue, recalled that he saw the ruling as a comment on the whole system:

"Dig a hole and you get depletion. Fill it up, and you get another deduction," he said. "The Lord giveth and the Lord taketh away." The lesson, he said, is that depletion "goes on and on; it almost never stops."

Percentage depletion is a subsidy, bestowed through the tax code, for exploiting natural resources. Conceived in an era of enthusiasm for plumbing the country's mineral wealth, it has survived the national mood swing toward conservation.

Depletion is like depreciation, only more so. Most industries are allowed to deduct only their costs. A company writes off only the cost of a machine as it wears out, for example. But under percentage depletion, mineral companies deduct a percentage of total income as they deplete their minerals, often several times the amount paid for them.

An independent oil man said he sold $1 million of oil on an investment of $50,000 in drilling rights. With a 15 percent depletion allowance, he deducted $150,000 from his taxable income, or 300 percent of his cost. An industry accountant said 200 percent is more typical.

The rationale is that mineral companies face high risks (independent oil companies drill an average of nine dry holes to one producing well), and therefore need extra incentive to stay in business.

Today, amid falling world mineral prices, industry leaders say they could not afford to extract many minerals crucial to building and fueling weapons without the tax breaks.

Percentage depletion will save the industry $1.5 billion in 1985 taxes, according to the Treasury Department. Treasury calls this a federal subsidy, similar to farm subsidies except that it is in the tax code rather than the budget.

At first, Congress gave percentage depletion to oil alone. Today the break is allowed for more than 100 "minerals," including oyster shells, sand, gravel and talc. In 1954, Congress added "all other minerals," except "soil, sod, dirt, turf, water or mosses" and certain others. Many materials were added in the name of equity: competing substances were eligible for depletion, and fairness dictated the others should get it too.

The most serious blow to the depletion allowance came in 1975 amid public uproar over rising oil prices resulting from the Arab embargo. Congress abolished percentage depletion for major oil companies that year.

But independent oil and gas firms still receive it and will claim about two-thirds of all depletion subsidies nationwide this year despite the Reagan administration's call for a "free market" energy policy, without price controls or subsidies.

No feature of the tax code has inflamed as many conflicts. Defenders credit it with nothing short of the survival of democracy, for it has spurred the development of strategic energy and mineral resources.

"As a result of its operation," Sen. Matthew M. Neely (D-W.Va.), drafter of the oil depletion allowance, said in 1951, " . . . the United States is today the last and only effectual barrier to the bloody conquest and brutal enslavement of the world by Josef Stalin and his godless, cutthroat, communistic minions."

Populists and tax reformers have damned it, particularly as it has spread.

"What [depletion] means to our national security in the case of sand, gravel, stone and oyster shells, I do not know," Sen. Hubert H. Humphrey (D-Minn.) said in 1951 in a lonely stand against expanding the allowance. "One does not have to go around exploring for gravel. In my state, all that is necessary to do is to stub one's toe and he will come across gravel . . . .

"This percentage depletion goes on forever," Humphrey said. "It is practically the only eternally living thing on Earth. So long as there is any sand left, we will have that depletion."

Washington attorney Dennis Bedell, tax adviser to the American Mining Congress (AMC), said the special treatment merely balances special circumstances of mining. Companies invest millions for as much as a decade before getting marketable materials out of the ground.

Attorney Lincoln Arnold, a predecessor of Bedell, no longer agrees.

"When I was representing the mining companies, I of course tried to defend their interests as they were paying me to do," said Arnold, AMC tax adviser from 1957 to 1964. "Percentage depletion was very valuable to them because many of the companies were getting half their income tax-free.

"But when I went to work for the government, I wanted to do what was right, what made sense," said Arnold, who became a congressional tax adviser. "You don't have that privilege sometimes when you're representing your client. I feel now that we should repeal all the depletion allowances and let people pay taxes on their profits. That's what the income tax was supposed to be all about." A Wartime Bonus

"Cost depletion" was created in the first Internal Revenue Code as a form of depreciation for natural resources. During World War I, amid tremendous demand for oil, Congress made it much more than that, allowing oil companies to deduct the appraised value, rather than the cost, of their oil -- a large bonus.

The change, made in the name of national security to spur oil drilling, did not go into effect until after the war, but it took root. In 1926, Congress created "percentage depletion," allowing oil companies to deduct 27.5 percent of their gross income.

Immediately, other segments of the mineral industry clamored for similar treatment, and in 1932, sulfur, metals and coal were counted in, at lower rates. In 1942 came ball and sagger clay, rock asphalt and fluorspar, prompting Wisconsin's Progressive Sen. Robert M. LaFollette, a vociferous depletion opponent, to declare:

"We are vesting interests which will come back to plague us. If we are to include all these things, why do we not put in sand and gravel?"

In 1951, 10 minerals later, Congress did exactly that.

That year, Congress also added oyster shells and clamshells, "minerals" in that they are sources of calcium carbonate. And it added slate, stone, shale, granite, marble, salt and more than 20 others.

Depletion now applies to almost any natural deposit that is finite and at least one, geothermal steam, that isn't. Beneficiaries get a designated percentage of gross income tax-free, up to 50 percent of their net profits.

Depletion rates vary, bearing little relation to the minerals' cost, according to Treasury. Independent oil and gas companies write off 15 percent; miners of sulfur, uranium and asbestos write off 22; metals, 14; gravel, 5.

Today, few features of the nation's landscape or life style go untouched by depletion.

The generous write-off for oil, since cut back, produced huge profits for oil companies, some of which helped provide Americans with cheap gasoline until the 1970s, according to a range of economists. The industry would have had to charge more for the same profits had it not enjoyed the tax breaks, which the Treasury footed.

As such, economists say the depletion allowance had a hand in the birth of the gas-guzzler automobile, migration to the suburbs, the growth of interstate highways, the all-electric home, the American love affair with air conditioning, and, with the rise of a Third World oil cartel, the dilemma of import dependence.

It also begat other depletions. In 1951, in an era of suburbanization and road-building, Congress created special depletion benefits for sand and gravel, ingredients of cement. The cement industry boomed, thanks partly to low prices and a demand for highways, both of which the tax code shaped.

"Whether you're talking about dams, buildings, houses or highways, depletion has traveled through the whole construction chain," said Kenneth Tobin, a tax attorney for the National Sand and Gravel Association.

The same is true for coal. Consolidation Coal Co., one of the nation's largest producers, expects percentage depletion to increase after-tax profits on a new mine by $800 million over the life of the mine, a company tax adviser said.

The National Coal Association says the coal industry will increase its profits by $600 million in 1985 alone from the depletion allowance.

"In a perfect world, if we could go back to the beginning, it probably would be okay to do without percentage depletion," said Robert Stauffer, tax adviser to the coal association. "But I believe it's too late. We strongly believe in our case, the system is built around so many of these special incentives that it's hard to get rid of them." The Texas Range

One way to learn how percentage depletion filters through the country is to travel through Texas, one of America's most depleting states: from oyster shell beds on the Gulf Coast (depletion allowance: 14 percent); to oil fields in Midland (15 percent); from south Texas limestone (14 percent), to sand and gravel near Dallas (5 percent). Out west in the Panhandle, farmers even get "cost depletion," or depreciation, for using water from the Ogalalla aquifer which has been shown to be drying up.

From border to border, the tax code "pays" Texans to plumb nature's bounty.

In Dallas, Joe H. Warren Jr. is an independent wildcatter, nurtured on cowboy capitalism and tax subsidies. He said he drills nine dry holes for every "hit," and uses tax subsidies to tide him over.

Under the depletion allowance, his company deducts up to 15 percent of its oil sales each year. (Percentage depletion was eliminated in 1975 for major, or integrated, oil companies with annual sales of more than $5 million.)

For successful wells, this greatly exceeds the investment that, in theory, is being written off. For unsuccessful ones, the company deducts only its costs.

This tax structure has moved tens of thousands of wealthy Americans to invest in oil wells as "shelters" from taxes, a key means by which independent oil companies lure financing. Independents now drill 87 percent of the wells in the United States and discover about one-third of the oil, with the rest being found by the majors, according to industry analysts.

"If the government does away with depletion, investors will say: Let's stop risking, and drill just no-risk or low-risk wells," Warren said. "The venturesome spirit would be severely damaged. If that happens, the country is in trouble. The majors are exploring for oil on the floor of the New York Stock Exchange [through mergers and takeovers]. We're looking in the ground."

However, the majors dominate the search for oil offshore, where the largest new finds are anticipated, and likely would drill more onshore if independents cut back their efforts, some analysts said. Contrary to initial warnings, the shift to cost depletion did not devastate the majors.

"It was like most things: You assume you can't survive if you lose one arm, or two, and then you do," said the tax counsel of one of the largest U.S. oil companies, who asked not to be identified. "We aren't as healthy as we were 10 years ago, but that's not just because of depletion. It's like we got hit in round two. Now we're in the fifth." Shelling Out a Break

Along the white sands of Texas' Gulf Coast, the depletion allowance shaped the rise, and also the fall, of a little-known industry that mines oyster shells from the seabed. Congress created a depletion allowance for mollusk shells in 1951, on the theory that ground-up shells were competing with minerals, such as limestone, that already were covered by depletion as ingredients for roadbeds, chicken feed and more.

Within five years, there was a run on Texas oyster shells. Dredging leapt from 5 million cubic yards a year in the 1940s to 12 million by 1956, according to Texas state records. By 1978, all but the most fragile areas near the coast were depleted. The state recently quintupled the permit price to discourage extraction, and most shell-mining has moved to Louisiana.

"For a long time, the shells were almost free to the companies. We were just about giving them away," said Rollin McRae, state coordinator for resource protection. "And then they were getting the tax write-offs on top of that." The Fruit of a Pit

About 30 miles from Dallas, a gaping gravel pit tells the story of the sand and gravel depletion allowance created in 1951.

Gifford-Hill and Co. Inc., one of the state's largest cement manufacturers, bought the resource for $2.5 million in 1964. The sand and gravel there would sell for about $134 million today, company officials said, giving the company a 5 percent depletion write-off of $6.7 million, or more than 250 percent its investment.

In all, the depletion allowance saved Gifford-Hill $2.4 million in taxes last year, wiping out more than half of its tax liability, according to its annual report. Other tax benefits for manufacturing in general wiped out the other half, and the company claimed a $933,000 refund on $10.9 million in income, the report said.

One of the strangest depletion allowances also originated in Texas, in the pancake-flat Panhandle.

A local engineer saw parallels between the irrigation water farmers were pumping from the Ogallala aquifer, running underground from South Dakota to Texas, and nearby benefit-producing gushers. The farmers were depleting the aquifer much like an oil well, he said.

Panhandle farmer Marvin Shurbet took this argument to court, and in 1962, the U.S. Tax Court ruled that Ogallala water in the Panhandle was in fact a depleting mineral. In 1982, the IRS extended the ruling to the full Ogallala, about 50,000 farms, or about one-fourth of the nation's farmland, since it is now known to be drying up.

An IRS official said the write-offs would cost the Treasury several billion dollars over the life of the aquifer.

Given the definition of depletion, he said, the farmers are entitled to it; but he added that while other federal agencies are working to conserve the aquifer, the Treasury, through the tax code, is "paying" farmers who deplete it.

Still, the individual write-offs are meager. The farmers get only "cost depletion" (the tax code bars percentage depletion for water), limiting their deductions to the amount paid for the water they have used.

Lifelong farmer K.B. Parish of Earth, Tex., just completed his 1984 tax return, and discovered that he could write off only $684 on a 160-acre tract, under which the aquifer declined two feet last year.

"The oil folks got the cow and we got the manure," he said. An Endangered Species

Percentage depletion marked one of the first times Congress used the tax code to make social policy -- to spur the search for oil -- rather than just to collect taxes. Today, amid a move to "simplify" the code, percentage depletion is an endangered species.

The Treasury Department, and two major congressional tax-revision plans, have proposed to abolish it, along with most other special tax breaks, using the extra revenue to reduce tax rates across the board.

But depletion, like most tax incentives, has powerful constituents. Oil and mining companies, among the largest contributors to congressional campaigns, are lobbying to save it. Mineral states are well represented on the House and Senate tax-writing committees. As a result, lobbyists and lawmakers are closely watching its fate in Treasury's forthcoming, revised plan.

"Any concessions are going to be focused on," said Lawrence F. O'Brien III, a tax attorney in the firm of Dewey, Ballantine here. "Depletion is one of those symbols. If they give in on that one, it will give off an aroma, and it could call into question the seriousness of the whole enterprise."

At the same time, industry spokesmen emphasize that subsidies for certain key minerals may be important to national security. Depletion no longer helps keep prices low for American consumers, because most natural resources are now part of a world market.

But world prices already are so low for Americans, partly from the strong dollar, that large segments of the U.S. mining industry are temporarily shut down. Without depletion, industry officials say, there would be even more mine-closings, more layoffs, a smaller domestic mineral supply and less chance of recovery.

The situation recalls the 1925 warning of Prof. Thomas S. Adams of Yale, a framer of the original tax code, when he told Congress:

"I think a great mistake was made when [an oil depletion allowance] was authorized. I think it is bad in theory and bad in practice. But . . . the industry has become habituated to it. It is something like accustoming a child to some debilitating or harmful luxury and not being able to take it away from him all at once. You must legislate in view of the situation that has been created."

Another perspective was offered by Parish as he stood on his farm, watching his irrigator spray water from the depleting Ogallala on his thirsty young wheat.

"When I was a kid, water was running down every one of these ditches. People just wasted it like it would go on forever," he said. "It was like the gas-guzzlers. Then, fuel was cheap and water was plentiful. You don't think about the value of these things when they're cheap."