It’s not easy, or inexpensive, to improve public infrastructure in NYC. But when private developers are involved, it can often work.

That’s what has to happen in Midtown East, where developers hope a change in zoning will let them build higher. In exchange for allowing developers to buy “air rights,” the city wants 20 percent of those sales to go to a fund for improvements on everything from parks to sidewalks, that the increased density will impact. In many cases, developers also will have to work on public transit upgrades — perhaps adding new entrances or better accessibility, or working on infrastructure for East Side Access, the effort to connect the Long Island Rail Road with Grand Central Terminal.

It’s up to City Hall and elected officials to make a deal that maximizes those benefits.

On Thursday, Manhattan Borough President Gale Brewer approved the Midtown East rezoning, but it has further to go. Earlier this year, the effort hit a snag, when Mayor Bill de Blasio tried to change a similar arrangement in the Theater District, but got pushback and pulled his proposal. At issue were some of the same questions faced in Midtown East, including whether there should be a minimum amount of money that goes back to the city.

City officials said a floor price for Midtown East air rights — to adjust based on market conditions — is necessary to prevent sellers from lowering prices to avoid paying into city coffers, while setting up other transactions to make up the difference. The real estate industry objects, saying a minimum price will stop sales. In her approval decision, Brewer suggested keeping a floor, but making it a lower price.

There has to be a middle ground, and a strong set of protections. Any rezoning must put the public’s needs first. The failure to make a plan work in the Theater District is worrisome, but serves as a teaching lesson to city officials and community leaders.

Attempts to rezone Midtown East failed in 2013. Don’t let history repeat itself. A deal to build higher has to come with a strong foundation that gets the most for the city, and only then can Midtown East soar.