The agreement also calls for an overhaul of the Metropolitan Transportation Authority, the agency that oversees New York City’s bus and subway system. Mr. Cuomo, who effectively controls the authority and who has been heavily criticized for the subway’s shoddy performance, has scapegoated the agency in recent months. As part of the budget deal, the authority’s policies will be changed to encourage speedier capital projects and to increase oversight.

A wave of new progressives in the Legislature believed the issue of criminal justice reform was of critical importance, and the new budget reflected that. Under the budget legislation, the state will eliminate cash bail for most misdemeanors and nonviolent crimes, though it will not be completely eliminated, as some of the Legislature’s more liberal members — still recalling the case of Kalief Browder, who took his own life after spending three years on Rikers Island because his family could not raise $3,000 bail — had hoped it would be.

Lawmakers and Mr. Cuomo also agreed to a number of changes to discovery — allowing defendants more access to evidence that prosecutors intend to use against them — and processes to ensure speedy trials.

The compromise on bail, which came after law enforcement officials expressed concerns about the total elimination of such a system, is one of many compromises that appear in the budget.

Another saw a proposed pied-à-terre tax, an annual recurring tax on second homes that were valued at $5 million or more, eliminated. Although the tax had the backing of state leaders, it evaporated under pressure from real estate interests and legal concerns.

In its place, lawmakers and Mr. Cuomo agreed to a “mansion tax” coupled with a real estate transfer tax, two one-time levies that would be charged at the point of sale on multimillion-dollar homes. The tax rate would top out at 4.15 percent on the sale of properties worth $25 million or more.

A plan to ban plastic bags in the state was also included in the budget, but it makes a fee on paper bags optional, which some environmentalists worry will lessen the popularity of reusable bags. New York would be the second state, after California, to ban plastic bags. (Hawaii also effectively has a ban in place, since all the state’s counties bar such single-use bags.)