The point is that the fusion reaction has produced 2x the power that the laser fed into it. So a 100% efficient laser (which is not physically possible) that injected 2MJ of power into the pellet would mean a net 4MJ of generated fusion energy. Then, you need some way to turn that energy into electricity, for which no realistic design exists in the case of ICF, so you'll lose more power.