When an alumnus donated several hundred gold South African Krugerrands to the University of Nebraska a few years ago, Ernie Chambers, a barber and Nebraska's only black legislator, got mad. That's how the Cornhusker State, where blacks are just 3.1 percent of the population, became the first in the nation to adopt economic sanctions against apartheid.

"It was a hot issue to me years ago when nobody was doing anything," said Chambers, whose nonbinding divestment resolution -- calling for the reinvestment of state pension funds that had been invested directly or indirectly in South Africa -- was approved in 1980 and made into law last year.

But Chambers doesn't feel so alone anymore.

In the past four years, five other states, including Maryland, and numerous towns and cities, including the District, have passed similar measures aimed at challenging South Africa's policies of racial segregation, according to the American Committee on Africa, a New York-based lobbying group that is tracking state and municipal divestment legislation.

Antiapartheid demonstrations and arrests are almost a daily occurrence outside the South African Embassy here, and Congress and more than 20 state legislatures are considering bills that would curtail or sever financial investments in the white minority-ruled country.

"It's a phenomenon gripping the country," said Joan Specter, a Philadelphia City Council member and wife of U.S. Sen. Arlen Specter (R-Pa.). "Now everyone is getting on the divestment bandwagon."

During 1982 alone, states and cities withdrew more than $300 million in publicly controlled funds from companies doing business with South Africa. Critics of apartheid said the overall financial impact of such action now tops $2 billion and will climb higher if they have their way.

In New York City yesterday, Mayor Ed Koch and top City Council officials announced proposals for some of the toughest antiapartheid sanctions yet, including a ban on buying goods and services that come from South Africa. The city was embarrassed recently when a worker in a city shelter discovered pineapples from South Africa being served to the homeless.

Council member Specter successfully led efforts in 1981 to get Philadelphia to sell off more than $90 million in city pension funds -- out of a total stock and bond portfolio of $650 million -- that had been invested in South Africa. She didn't mince words when she talked about that country's apartheid system.

"It's an abomination," she said tersely this week. That is essentially what she told South Africa's ambassador to the United Nations when he came down from New York to try to talk her out of sponsoring the legislation.

"He told me they were doing all they could, that the issue was much more complex than I knew, that they were making reforms," Specter recalled. "I told him, 'You're the only country in the world that legislates discrimination.' "

Specter said she encountered surprisingly little opposition to her divestment bill, only concern about whether it could be done without causing financial losses for city employes.

"The city treasurer wasn't too thrilled," she said. The measure gave the city two years to divest, and Specter said it was done on time, with a slight extension, without adverse impact on Philadelphia's pension fund.

Provisions in the antiapartheid bills vary. Massachusetts approved a blanket prohibition against investments in South Africa. Nebraska, however, exempted companies that have attained a "good progress" rating under terms of the Sullivan Principles, a voluntary code of conduct for U.S. companies operating in that country pledging them to desegregate their facilities and pay equal wages to blacks.

Massachusetts, which enacted its more sweeping divestment bill two years ago, began selling off about $180 million in direct and indirect South African investments even before the bill became law. State Sen. Jack Backman, a key sponsor, said the state "got a book profit and our new investments will enhance our portfolio."

South African government officials have said that neither the demonstrations nor present and future economic sanctions will influence the country's policies and that such actions might, in fact, create a backlash against current reform efforts. Divestment measures, they argued, are opposed by the majority of black South Africans because such bills will result in a loss of jobs.

D.C. Council member John Ray (D-At Large) has heard those arguments before, but said they didn't stop him from sponsoring legislation, enacted last March, that prohibits the District from banking or investing in companies that do business with South Africa or Namibia.

"Black South Africans are concerned about more than a few jobs," said Ray, who has met numerous visitors from those regions. "They're concerned with their civil rights and human dignity."

Ray, who is drafting another bill that would penalize firms that do business with South Africa in competing for city contracts, said U.S. firms account for less than 1 percent of all jobs in that country, usually the lowest-paying ones. The law is being applied gradually over two years, and so far, the city has divested $35 million worth of stocks, with about $17 million to go.

Ray met earlier this week with Tandie Rankoe, 46, a nurse and South African exile who now lives in Botswana. She is currently traveling in this country at the invitation of the Institute for Policy Studies and stopped by Ray's office for a copy of the D.C. law, which she supports.

"Blacks have been suffering for so long, and this suffering will continue if the U.S. continues to invest in South Africa," Rankoe said.

According to a recent study, 284 American firms operate in South Africa, of which 57 are among Fortune magazine's top 100 corporations.

Maryland last year enacted a law prohibiting state deposits in Maryland banks that make future investments in South Africa. This session, Sen. Clarence M. Mitchell III and Del. Howard P. Rawlings, both Baltimore Democrats, hope to strengthen sanctions by passing measures to ban the purchase of goods and services from South Africa with state funds, force the University of Maryland to divest about $6 million it has invested in firms with ties to South Africa and declare a year's moratorium on pension-fund investments with companies that do business with South Africa.

New York City already has voted to phase out pension fund investments in South Africa over the next five years, a move that means reinvesting about $1.5 billion in pension funds currently held by 148 companies.

The measures now before its City Council would prohibit New York from making deposits in banks that advertise or promote the sale of Krugerrands and other South African coins; prohibit most dealings with banks that underwrite securities or make loans to South Africa; and restrict the city from buying South African-supplied goods and services or making contracts with firms that sell to South Africa's military, police, prisons or its Department of Cooperation and Development, which administers the country's pass law system.

In addition to Nebraska, Massachusetts and Maryland, sanctions against South Africa have been adopted by Connecticut, Michigan and Wisconsin. Prospects for passage of similar measures look good in Oregon, Kansas, New York, New Jersey and Ohio, according to antiapartheid activists, who said it generally takes three years for an introduced bill to become law.

Wilmington, Del.; Berkeley, Calif.; East Lansing, Mich.; Davis, Calif.; Hartford, Conn.; Boston and Charlottesville are among the cities that have imposed similar sanctions.