FRANKFORT, Ky. — Power companies in the coal-dependent state of Kentucky would likely pay less for the energy generated from residential solar customers under a bill that has narrowly cleared the Kentucky House of Representatives.

People with solar panels on their homes generate their own electricity. When they don’t have enough power, they buy it from the utility company. When they have too much power, the utility company buys it from them. Right now, the law requires utility companies to buy the power at the same rate they sold it. People with solar panels on their home then get a credit on their power bill, paying less than customers who don’t have solar panels.

House bill 227 would let the Kentucky Public Service Commission decide how much power companies should pay. The commission would likely set that rate lower than current law, because they would consider how much it cost the utility companies to maintain the grid.

The program is called “net-metering,” and 38 states have it, according to the National Conference of State Legislatures. But since 2015, five states have eliminated those programs and replaced them with something else. Seven states — Arizona, Georgia, Hawaii, Indiana, Maine, Mississippi and Nevada — offer something other than net metering, which the NCSL defines as offering full retail rate compensation.

Utility industry advocates say the bill is necessary to make it fair for people who can’t afford to install solar panels. Power bills cover more than just the cost of generating electricity, but also what it takes to transport that power to the house. Advocates say solar customers still use the grid, but they don’t pay their fair share for maintaining it. Republican Rep. Jim Gooch, who sponsored the bill, called residential solar customers small businesses because they are generating power and selling it.

“I don’t think anyone out there is forced to buy your excess inventory or excess product and pay you a price that will generate a profit for you. Yet that is what we are really doing,” Gooch said.

But solar companies say the change will put them out of business. Most home solar systems cost about $20,000, not including federal tax credits. Under current law, it takes a person about nine years to recoup that investment, according to Jason Clarke, owner of the residential solar company Synergy Home in Lexington. It would take people longer to do that if they get less credit for the power they generate, which would make it harder to sell the systems.

The bill had at least 30 amendments filed, which ordinarily would make it tough to pass. But Republican leaders sent the bill back to committee, which quickly passed an amended version late Wednesday afternoon. That meant all the previous amendments were invalid. GOP leaders then called the bill for a vote on Thursday, which did not give opponents time to file amendments. It’s an often-used tactic to pass controversial bills.

The bill passed 49-45.

Some supporters, including Republican Rep. Brian Linder, said net-metering without changes amounts to a subsidy for people who can afford to install solar panels. Everyone else, he says, has to pay more when power companies raise their rates to compensate.

But opponents, including Republican Rep. Phil Moffett, said that wasn’t true. He noted the number of residential solar customers in Kentucky was so small it shouldn’t make a difference

“There is no guarantee that giving the utility companies any kind of break will be passed on to the customer,” Democratic Rep. Angie Hatton said.

The bill still must pass the state Senate before it can become law.