The volume of a hadron is small. By the Heisenberg Uncertainty Principle, the kinetic energy of the quark is inversely proportional to the radius of its confinement. So the smaller the confinement, the larger the kinetic energy of the quarks. This energy contributes to the mass of the hadron (E=mc^2).