Privatization is one of the hottest topics in state and local government. Google the word and you come up with around 12 million entries. But for all the articles and academic reports on the best approaches to outsourcing government services, there’s also a surprising amount of activity around insourcing.

These days, roughly the same percentage of services that are newly being contracted out are being brought back into the government fold, according to Mildred Warner, a professor of city and regional planning at Cornell University. Her examination of data accumulated by the International City/County Management Association (ICMA) for the period from 2007 to 2012 showed that new outsourcing accounted for 11.1 percent of all services and new insourcing accounted for 10.4 percent of all services.

Minneapolis, for example, has been involved in moving its IT technical support -- specifically help desks and desktop support -- in-house, and away from private-sector firms. Why? A misalliance of goals was part of the problem. The vendors wanted “to get a call off their docket as quickly as possible. So a lot of shortcuts were taken,” says Otto Doll, chief information officer for Minneapolis. “There was a lot of patching of things, rather than looking at systemic issues.”

Not only has quality improved with the shift, there have been significant dollar savings. Of Minneapolis’ IT outsourcing contracts, the single most profitable portion for the contractor had emanated from help desks and desktop support. With those functions now in-house, Doll estimates that the city will realize nearly $3 million annually.

Of course, the potential benefits of outsourcing are pretty widely known. A fundamental one is the notion that the private sector can deliver services more effectively and efficiently than can government. But insourcing has some advantages too.

According to Warner’s analysis of ICMA data, the two main reasons governments reverse their privatized services are inferior service quality and a lack of anticipated cost savings. Additionally, improvements in the capacity of local governments to work with greater efficiency can make them the more appealing alternative.

In 2014, for instance, Idaho reversed a prison privatization decision when it became frustrated over less-than-acceptable service delivery. Back in the late 1990s, the state built the Idaho Correctional Center, a 2,000-bed mixed security facility just south of Boise, and then outsourced the operations. “The attitude was that the private sector could do it more efficiently,” says Josh Tewalt, the Idaho Department of Correction’s budget and policy administrator.

But by 2013, inmate violence, much of it driven by a failure by the private corporation to provide adequate staffing to deal directly with inmate gang activity and other inmate practices, had resulted in a series of high-profile lawsuits and media attention. The prison became known as the “Gladiator School” for the fighting that took place inside.

When state leaders decided in 2014 to insource prison management, several positive benefits emerged. In recent years it had been difficult for the state to shift inmates from that facility to others. “When the 2,000-bed facility was privatized,” says Tewalt, “it couldn’t say, ‘This guy is a bad actor, let’s get him out of this facility and try another one.’ [It] had to manage him in that environment.” Now that it’s one system, the state has the flexibility to move inmates from one facility to another in order to best match an inmate’s needs with his surroundings.

Tewalt stresses that he’s not indicting privatized prison services as a rule. The corrections department has a number of other contracts with private contractors for such services as health, food, food service and similar functions.

One significant function of state governments that has seen a significant turn to insourcing is in the investment of funds in pension plans. The majority are still managed externally, but as Keith Brainard, research director of the National Association of State Retirement Administrators, explains, “larger funds are more likely to manage internally since they can generate the economies of scale that makes the cost of money management relatively small.”

The key equation here is that states and localities typically have to pay investment fees between .25 and 1.5 percent to external managers. At a time when many money managers have not been outperforming the market as a whole, there’s less appetite for spending on a service with minimal additional return.

The Municipal Employees’ Retirement System of Michigan, for example, has made the switch and is saving $3.2 million a year on fees, according to Jeb Burns, chief investment officer there. In 2000, only 1.5 percent of funds were managed internally. Today it’s 24 percent and growing.

Not all services lend themselves to a smooth transition from outsourcing to insourcing. With prisons, for instance, a corrections department may have outsourced a prison or two, but the state is still in the business of running and managing correctional facilities. With other functions, however, the major obstacle to insourcing is that the government no longer has the personnel or physical infrastructure to provide the service again. “If you sold your assets and fired your workers, you’ve lost most of your internal capacity,” says ICMA’s Warner. Insourcing may be nearly impossible without restarting an entire line of business.