Difference in work done by a gas in reversible and irreversible isothermal expansion
For a massless piston, the force per unit area exerted by the gas on the inner face of the piston is exactly equal to the external pressure exerted by the surroundings on the outer face of the piston, irrespective of whether the expansion is reversible or irreversible (by Newton's 2nd law).  The work done on the surroundings is thus always equal to the integral of the external pressure integrated over the volume change.

However, for an irreversible expansion, the force per unit area exerted by the gas is comprised of two components: (1) the local gas pressure at the piston face (as determined by applying the ideal gas law locally) and (2) viscous stresses that are proportional to the rate at which the gas is expanding.  Furthermore, in an irreversible expansion, the gas pressure and temperature are typically not even uniform within the cylinder.  

In a reversible expansion, which is carried out very slowly, the viscous stresses are negligible (since the rate of expansion is negligible), and the gas pressure and temperature are uniform throughout the cylinder. Thus the external pressure is equal to the uniform pressure of the gas calculated from the ideal gas law.  Consequently, for a reversible expansion, one can use the pressure calculated from the ideal gas law in place of the external pressure to calculate the work done.

To get a better feel for how this all plays out, particularly with regard to viscous stresses and viscous dissipation, please see the following link:  https://www.physicsforums.com/insights/reversible-vs-irreversible-gas-compressionexpansion-work/.  This article points out the close analogy between the transient behavior of an ideal gas experiencing an irreversible expansion or compression, and that of a spring and damper connected in parallel. It demonstrates that the physical mechanism responsible for the difference between the irreversible work and the irreversible work is viscous dissipation of mechanical energy to thermal energy (yes, even in the ideal gas region, gases exhibit non-zero viscosity).