Instructions
Go to World 2-4 and play through the level normally until you approach the flag that marks the end.
Find the Koopa Troopa coming down the stairs near the flag. Jump on his head to make him retreat into his shell, but don't jump on or kick the shell yet.
Stand on the step below the shell and press up against the next step as closely as you can.
Jump up, without touching the D-pad, and then let go as Mario begins to jump repeatedly on the shell. As he jumps, your points, and eventually your lives, will begin to rack up; simply let go of all the controls and let Mario continue to jump until you have the maximum complement of 99 lives.