Massachusetts communities including Boston, Somerville and Nantucket are joining forces to push the Legislature to allow them to tax some real estate deals and use the money to bolster affordable housing.

The cities and towns each have different home rule petitions before lawmakers. At the same time, a proposal would allow communities to assess a tax of up to 2% without needing approval from lawmakers.

Among those advocating for the new tax is Ken Beaugrand of the Nantucket Association of Real Estate Brokers. While Nantucket’s real estate agents could be the outliers in supporting a transfer tax, Beaugrand says the housing crisis is so severe on the island that even agents are pushing for the measure.

"The real estate brokers on the island recognize that in order to be able to have a lively, ongoing community, you have to be able to have people be able to live there,” Beaugrand said.

The new legislative proposal is being touted as a "compromise" by the sponsors of various local option transfer tax bills and communities filing home rule petitions for transfer taxes. It would allow taxes on real estate transactions above the statewide median sale price for single-family homes. In Boston’s home rule petition, the tax would only be assessed on deals above $2 million.

The proposed tax is a linchpin in Boston Mayor Marty Walsh’s plan to invest $500 million in affordable housing over five years, and now Brookline, Concord and Cambridge are looking at how the new revenue stream could play into their affordable housing strategies.

One of the bill’s sponsors is Rep. Mike Connolly of Cambridge and Somerville. He points to highly lucrative real estate deals that result from the immense demand for property in the region, and says it’s only fair that those profiting the most should do their part on the housing front.

“What you're seeing is hundreds of millions of dollars of value being extracted from our communities,” Connolly said. "... Couldn't we capture just a tiny fraction of that?”

Greg Vasil, CEO and president of the Greater Boston Real Estate Board, says his sector shouldn’t be singled out to address the region’s housing shortage.

"If it truly is [a housing crisis] and we believe it is, we all should pay in in some form — everybody that lives here should pay something toward it,” Vasil said.

Theresa Hatton, CEO of the Massachusetts Association of Realtors, says that while the state is in the midst of an affordability crisis, the bill would only intensify the problem.

" A sales tax on homes will increase the bottom-line price of homes, for many, by thousands of dollars,” Hatton said in a statement. " This raises the barrier to home-ownership many families already face due to the high cost of housing in Massachusetts.”

The municipal home rule petitions take various approaches to the fee. Nantucket's bill would have the seller pay half of a percent, with the first $2 million of the sale price exempt. In Concord, the buyer would pay 1% of the portion of the purchase price over $600,000.

Rep. Dylan Fernandes, who filed a bill last year that would allow a transfer fee on sales over $1 million, said the group drafted its plan with high-priced real estate in mind, but chose the state median as a threshold so the option would be available to communities that like the idea but don't have many million-dollar homes. He said he expects interested municipalities would set higher thresholds, like the $2 million proposed in Boston.

"We recognize that there's 351 very distinct towns in the state," the Falmouth Democrat said in an interview with State House News Service. "All of them for the most part are in some sort of housing crunch, but they may look very different in terms of where they are... so that's why we chose the median sales price."

With reporting from State House News Service