Sheldon S. Cohen, a tax lawyer and certified public accountant who helped set up the first presidential blind trust, for Lyndon B. Johnson, and then helped fully computerize the IRS as Johnson’s commissioner of internal revenue, died Sept. 4 at a nursing home in Chevy Chase, Md. He was 91.

The cause was complications from congestive heart failure, said a grandson, Reuben C. Goetzl.

Mr. Cohen, a native Washingtonian and son of a Lithuanian-born shopkeeper, graduated first in his law-school class at George Washington University in 1952. He then joined a cadre of young lawyers at the Internal Revenue Service who drafted a massive overhaul of the federal income tax code.

His role shaping the new tax code, which took effect in 1954, vaulted him to prominence in the field of tax law. He soon left government work for private practice and was recruited to the politically connected firm of Arnold, Fortas and Porter. One of the partners, Johnson confidant and future U.S. Supreme Court Justice Abe Fortas, became Mr. Cohen’s mentor.

Shortly after President John F. Kennedy’s assassination in November 1963, Mr. Cohen said, he was headed to Friday-evening services at his synagogue when Fortas summoned his protege. Johnson, newly elevated from the vice presidency to the presidency, needed his business affairs put in order immediately.

The Johnsons had long owned a radio and television station in Austin. “I was the only one who wanted to sell the radio station on the basis that it was a terrible conflict,” Mr. Cohen said in an oral history with the Jewish Historical Society of Greater Washington. “Fortas looked at me and said, ‘He’ll kill ya.’ He agreed to set up a blind trust.”

Mr. Cohen had experience creating such trusts, which allow investors to maintain their assets but avoid the conflicts of interest that might arise through their daily management. The 1978 Ethics in Government Act made blind trusts the preferred vehicle for public officials who do not want to dispose of holdings that carry potential conflicts.

Mr. Cohen returned to the IRS in 1964 as chief counsel. Johnson named him commissioner the next year, a time when the agency was warily beginning to adopt computer technology for the processing of returns. Such mechanization, which allowed the agency to track each taxpayer with a number, stoked fears of government overreach. Mr. Cohen argued that the modernized system would more efficiently identify and discourage tax fraud.

When it came time to use the state-of-the-art IBM system, however, Mr. Cohen proceeded cautiously and ordered that tax returns be tabulated by computer and then checked by hand.

“I am not going to be the commissioner on whose watch the system fails,” he recalled thinking, according to what he told a publication of the American Bar Association. “So we did it both ways that first year, and the computers worked fine. So the next year we switched off.”

As a new commissioner, Mr. Cohen also responded to the uproar when the agency’s history of aggressive enforcement practices, including wiretapping in serious criminal cases, came to light.

Sen. Edward Long (D-Mo.), who led a subcommittee investigating electronic surveillance methods across many agencies, accused the IRS of flagrant violations of constitutionally protected privacy.

In 1965, Mr. Cohen called Long’s claims “overblown,” insisting that the wiretaps were chiefly focused on racketeers attempting to bribe IRS personnel. But two years later, Mr. Cohen admitted in a letter to Long that the extent of wiretapping was far more extensive than initially revealed. By his count, the IRS had made “improper” and “questionable” use of wiretapping 287 times between 1958 and 1966, mostly owing to the “overzealousness on the part of certain personnel engaged in the investigation of the criminal element.”

Although his sparring with Long generated negative headlines, Mr. Cohen said it was far from his greatest concern during his four-year tenure. “The most embarrassing thing that happened to me in office was that millions of persons below the poverty line had to pay taxes,” he said in 1969 as he championed a system in which the poorest Americans would not pay income taxes.

Charlotte Crane, a professor and tax historian at Northwestern University’s law school, said Mr. Cohen’s proposal presaged the adoption in 1975 of the federal Earned Income Tax Credit, a refund meant to offset payroll taxation for low-income filers. “He was one of the leading members of the tax bar willing to stick out their neck in favor of that kind of reform,” she said.

Sheldon Stanley Cohen was born in Washington on June 28, 1927. His first experience in finance, he said, was helping his father with deliveries at the family business, Potomac Butter and Egg. After graduating from Coolidge High School in 1945, he served in the Navy at the end of World War II. He received a bachelor’s degree from GWU in 1950.

In 1969, Mr. Cohen and IRS general counsel Lester Uretz formed a boutique tax-law practice. It was absorbed in 1985 by Morgan, Lewis and Bockius, where Mr. Cohen remained until retiring three decades later. He then spent several years as a senior counsel and director of Farr, Miller and Washington, an investment-management firm.

Through his friendship with Robert S. Strauss, the Texas-bred power broker and Democratic National Committee chairman, Mr. Cohen was recruited to serve as the committee’s general counsel in the wake of Richard M. Nixon’s landslide reelection victory in 1972. He helped settle a civil case stemming from the break-in and bugging of DNC offices at the Watergate office complex by Nixon campaign operatives.

Mr. Cohen, a longtime resident of Somerset, Md., was an officer in Jewish, community and legal groups. He also advised foreign countries on their tax systems.

His wife of 67 years, the former Faye Fram, died in April. Survivors include four children, Melinda Cohen of Adamstown, Md., Laura Apelbaum and Jonathan Cohen, both of Chevy Chase, and Sharon Cohen of Cabin John, Md.; a brother; a sister; and 10 grandchildren.

The IRS is an agency that rarely draws praise from political leaders, but Mr. Cohen told the ABA publication that Johnson took an “immense” interest in boosting his office’s morale.

For two years straight, the president invited IRS leadership and many of its lower-level employees to the White House for coffee, cake and a pep talk. By his third year on the job, Mr. Cohen said, he began to feel that he and his staff were imposing themselves on the president — amid the Vietnam War and other pressing matters of state — and instead invited the vice president to IRS headquarters.

Mr. Cohen’s office phone soon rang. It was Johnson. “Don’t you love me anymore?” the president inquired in his persuasive Texas twang.

The commissioner agreed to ferry the IRS team back to the White House for another coffee klatch.