Massachusetts will invest millions in green technology and require utilities to buy more renewable energy as part of a sweeping energy bill signed by Gov. Deval Patrick this week.

The Green Communities Act removes restrictions that previously prohibited utilities from owningsolarprojects and from leasing them to customers. The new law also requires utilities to invest in energy efficiency-technologies and programs.

As part of the act, the state also officially joined the Regional Greenhouse Gas Initiative, which plans to set up a multistate cap-and-trade program for carbon-dioxide emissions. Massachusetts pledged to set aside $10 million generated from the program to set up no-interest loans and other programs.

The law will encourage more venture-capital investments and promote cleantech, said Rob Day, a principal at @Ventures’ Wilmington, Mass., office.

“You can’t underestimate the importance of a signal from the state about its support for a small industry like cleantech,” said Day, who authors Greentech Media’s Cleantech Investing blog. “Entrepreneurs know they will get the state support when they develop new products. Investors know there will be state-level support when they invest.”

In contrast to the federal government, which has been unsuccessfully trying to extend renewable-energy credits for months, state governments have picked up the pace of legislation designed to support solar, wind and other green energy sources (see As National Incentives Fail, States to Fuel Renewables).

For example, 27 states and Washington D.C., have set renewable portfolio standards requiring utilities to get a certain amount of electricity from renewable sources, according to the Pew Center on Global Climate Change.

California passed a comprehensive energy bill two years ago and is now devising plans to carry out the provisions (see California Offers Plan to Clean the Air).

Meanwhile, the Pennsylvania legislature on Thursday passed the Climate Change Act, which will become law once Gov. Edward G. Rendell signs it. The act will require an inventory of the amount of pollution generated by the state and set up a voluntary program for businesses to track their greenhouse gas emissions and get credits for reducing them. It also directs the state Department of Environmental Protection to create a plan for reducing emissions.

Supporting green technology is now a pre-requisite for local and national politicians. San Francisco Mayor Gavin Newsom, who this week declared his interest in running for governor, signed the nation’s largest municipal solar program last month (see California Solar Incentives Become Official). The San Francisco program would provide between $2 million and $5 million per year to residents and businesses for solar installations over the next 10 years.

Republican presidential candidate John McCain said, if elected, he would create a $300 million prize for a cutting-edge battery technology for powering cars. His Democratic opponent, Barack Obama, said he would invest $150 billion over 10 years for developing renewable energy.

In Massachusetts, the Green Communities Act sets several mandates for utilities. It requires them to buy 25 percent of their electricity from renewable sources by 2030. But that may be an ambitious goal, given that the power companies have yet to meet the current requirement of 3.5 percent.

Utilities must also sign long-term contracts of 10 to 15 years with renewable energy developers. The provision aims to help renewable energy projects from getting bank loans.

The law promotes energy-efficiency technologies and programs. Utilities are now required to invest in energy efficiency – both in new technologies and programs for the grid and in consumer incentives – when doing so is cheaper than buying the equivalent amount of saved power.

“It’s cheaper to save a kilowatt hour than to burn coal and build a wind farm,” Day said. “It makes economic sense to get people to reduce consumption instead of buying power at peak time from dirty sources.”