In a clever procedural move by Democrats, Republicans were forced into some somersaults when a more conservative budget than Ryan's was offered in a substitute amendment by Rep. Scott Garrett, R-N.J. Since only a simple majority is needed to pass a bill, most of the House Democrats voted "present" and thus brought down the magic number needed for passage.
The trick almost helped the bill pass -- and would have embarrassed the GOP leadership in the process -- but after numerous Republicans switched their votes, the amendment failed 119-136, with 172 Democrats voting present.
The bill is not expected to pass in the Senate.
"The Republican plan to end Medicare and immediately raise prescription drug costs for seniors in order to pay for millionaire tax breaks will never pass the Senate," Senate Majority Leader Harry Reid, D-Nevada, said. "The fact that it passed the House shows just how far to the right the Tea Party has dragged the Republican Party."
ABC News' Jonathan Karl, Sunlen Miller and Jake Tapper contributed to this report