Three weeks after the start of the new fiscal year, Democratic leaders finalized a fiscal 2020 budget agreement over the weekend to end a weeks-long stalemate and authorize $43.1 billion in state government spending over the next year.

The deal, which is expected to be voted on Monday by both the House and Senate, puts the state in position to potentially have a budget in place in time for the Legislature to avoid having to approve another stopgap spending measure. If Gov. Charlie Baker signs it within 10 days, Massachusetts may also avert being the last state in the country without a signed full-year budget, as it was last year.

After negotiations that began in early June, House and Senate leaders chose not to include new taxes on opioid manufacturers or e-cigarettes and vaping products. Both tax plans were initially proposed by Republican Gov. Charlie Baker and backed by the Senate, but the House felt they should go through the committee process.

The budget also dropped the Senate's proposed freeze on tuition at the University of Massachusetts next year, and did not increase funding for the five-campus system beyond the $558 million recommended by the governor and both branches, making a tuition hike for students next year likely.

The bill does include a plan to control pharmaceutical drug costs that closely resembles the one that passed the House after intense lobbying by the life sciences and biopharmaceutical industries.

"There were some complex issues, particularly on the outside sections of this budget that took some time to negotiate and some of these policy pieces take a long time to get done, but we're happy to finally come to an agreement on some of these important issues that we face in the commonwealth and get this budget to the governor's desk," said Rep. Aaron Michlewitz, the chair of the House Ways and Means Committee.

The drug pricing compromise authorizes the Executive Office of Health and Human Services to negotiate supplemental rebates for MassHealth on the most expensive drugs, but would not force drug companies to testify before the Health Policy Commission at a public hearing if a price agreement can't be reached, according to officials.

The bill does not include a process for the commission to refer drug companies to the attorney general for possible prosecution under the consumer protection laws, and leaves it up to the Baker administration if it wants to publish a recommended price for certain drugs.

Michlewitz said that drug pricing was one of the policies in the budget that took longer to resolve, and Rodrigues called it "the most complicated piece."

The final budget's bottom line, according to legislative officials, was boosted by optimism tied to surging tax collections that allowed negotiators to increase collection expectations for the the coming year by nearly $600 million.

Some of the money went into priorities like a fund to help struggling nursing homes, which will receive $50 million — the combined recommendation of both the House and Senate. The budget also sets up a task force to be led by Health and Human Services Secretary Marylou Sudders to study the nursing home industry's challenges and report back early next year.

The conference committee also adopted the Senate's higher recommendation for nearly $5.18 billion in Chapter 70 public school aid, an increase of $269 million from last year.

The revised tax estimates also led budget negotiators to increase the assumed deposit into the "rainy day" fund from capital gains at the end of fiscal 2020 by $230 million, which would put the balance of that reserve fund above $3 billion. And the School Building Authority and the MBTA also automatically receive an additional $23 million each based on the revised revenue assumptions.

The budget bill was filed late Sunday afternoon, days after the chief negotiators — Michlewitz and Rodrigues — signaled Friday in a statement that they planed to wrap up work this weekend.

Both branches planned formal sessions for Monday in anticipation of the deal. The Legislature is the last in the country with a fiscal year start date of July 1 to finalize a budget accord, though the governors in three other states — New Hampshire, North Carolina and Oregon — have still not signed a budget for fiscal 2020.

Baker will have 10 days to review the budget from whenever it reaches his desk, and will be in Colorado until Wednesday where he is attending the annual meetings of the Republican Governors Association.