Catalysis of the reaction: (R)-pantolactone + NADP+ = 2-dehydropantolactone + NADPH + H+. The reaction is B-specific (i.e. the pro-S hydrogen is transferred from the 4-position of reduced nicotinamide cofactor) with respect to NADP+.