Private prisons began a resurgence in the United States in the 1980s with the law-and-order, privatization and anti-union campaigns of the Reagan revolution. They helped ease overcrowding in state and then federal prisons as inmate populations swelled, while budgets were constrained.

But in 2013 the prison population began to decline, a trend that seemed likely to continue, with the help of changes in sentencing laws, the rise of alternatives to imprisonment and a softening in parole policies.

On Aug. 18, Sally Q. Yates, the deputy attorney general, said in that Justice Department memo that the Federal Bureau of Prisons was “beginning the process of reducing — and ultimately ending — our use of privately operated prisons.” The memo was a bombshell: In one day, shares of CoreCivic (then Corrections Corporation of America) fell 35.5 percent. GEO dropped 40 percent.

From a purely financial standpoint, that horrendous market decline may have been an overreaction.

The Yates memo referred only to phasing out or reducing contracts with the Federal Bureau of Prisons. Those contracts amounted to less than 16 percent of the two companies’ revenue, according to filings with the Securities and Exchange Commission. Far more money — 44 percent of CoreCivic’s 2015 revenue, said Terry Dwyer, an analyst with KDP Investment Advisors — flowed from contracts for detention centers run on behalf of Immigration and Customs Enforcement and the United States Marshals Service. On Thursday, a Homeland Security panel recommended that those agencies keep using private prisons.

Even as the Federal Bureau of Prisons announced that it was ending a contract with CoreCivic to house inmates in Cibola County, N.M., CoreCivic promptly got a new contract to run the same center on behalf of Immigration and Customs Enforcement.

The Obama administration’s approach is “an inconsistent revolving door policy,” Carl Takei, staff attorney for the national prison project of the American Civil Liberties Union, said. The A.C.L.U. objects to private prisons as a matter of principle, he said, adding that they engage in “profiteering.”

“These companies by their nature depend on and profit from mass incarceration,” Mr. Takei said.

Pablo Paez, a spokesman for GEO, said in an email: “We do not believe in cost-cutting for profit sake as critics like the A.C.L.U. contend, instead we believe in running an efficient operation that provides adequate staffing and relies on state of the art technology for monitoring, communication and health care.”