When companies settle claims of wrongdoing, they are often compelled to pay for environmental or community development projects as well as pay fines and direct compensation to victims. Sometimes the third-party payments are only marginally related to the damages caused by the company’s actions.

To settle claims from the Gulf oil spill, BP was required to spend billions on coastal restoration projects that were not directly related to spill damage. Volkswagen is financing electric vehicle charging stations under its settlement of the diesel emissions cheating scandal. Duke Energy paid for soil restoration on federal land as part of its compensation for air pollution violations at some of its power plants in North Carolina.

That longstanding practice is now under attack on two fronts, potentially jeopardizing a source of financing for initiatives across the country that supporters say have paid great environmental and social dividends. Critics say the practice effectively creates “slush funds” for favored organizations or causes.

Attorney General Jeff Sessions, in a memo issued this week, directed the Justice Department to no longer include funding for projects managed by outside groups in settlements with corporate wrongdoers. The settlement money will instead go exclusively to the federal Treasury or to victims of the company’s actions, Mr. Sessions said.