“This is definitely a win for the Freedom Caucus,” said Charlie Sykes, the former conservative radio host and longtime friend of both Mr. Ryan and Reince Priebus, Mr. Trump’s chief of staff. Mr. Priebus made getting a health care bill passed in the House a career-defining moment for himself, and he negotiated at length with the conservative lawmakers. Mr. Ryan singled him out for praise at a Rose Garden ceremony after the vote.

“They moved the bill right and the moderates caved,” Mr. Sykes said. “That creates an interesting dynamic.”

To get his victory, Mr. Ryan cast aside many promises he had made when he became speaker about transparency and moving bills through committees and a process. Instead, he threw together bills without hearings, made back-room side deals to buy off individual lawmakers, and held votes on measures before the Congressional Budget Office could put a price tag on them.

The process alienated committee chairmen, whose work took a back seat to the efforts of the elusive chairman of the House Freedom Caucus, Representative Mark Meadows, Republican of North Carolina, and it chipped away at their authority. Mr. Meadows and his fellow conservatives, who have toiled for years as philosophical bomb throwers in the legislative process, got the attention of the White House, which worked hard to meet their needs and pressure moderates to come along.

Mr. Ryan spent much of April calling and visiting colleagues in order to get the measure passed. But in the end, there is little guarantee that the Senate will be able to live with the House bill. This is particularly true for senators from states where Medicaid coverage expanded under Mr. Obama’s program. “Senate Republicans may look back on the appeasement of the Freedom Caucus as a poison pill,” Mr. Sykes said.

That sentiment was already being felt in the House.

“Members have been asked to vote for a bill that is particularly treacherous, that is going nowhere in the Senate,” said Representative Charlie Dent, the Pennsylvania Republican who has led the opposition among moderates. “This legislation will be gutted and we will have voted for a bill that will never become law. Will it cause headaches for people? Absolutely.”