In the context of special relativity, the rest mass of a system is defined as the invariant mass, which is the mass measured in the rest frame of the system. Photons, on the other hand, are massless particles according to the currently accepted understanding of physics.
When photons are confined within a box, the presence of the photons does not cause an increase in the rest mass of the box. This is because the energy of the photons contributes to the total energy of the system, but not to the rest mass. The rest mass of the box remains the same regardless of whether it contains photons or not.
It is important to note that the concept of rest mass is not applicable to massless particles like photons. Rest mass is a property associated with particles that have rest frames, where their energy and momentum can be transformed to a rest frame where the momentum is zero. Since photons always travel at the speed of light, they do not have rest frames, and their energy and momentum cannot be transformed to a frame where they are at rest.
Therefore, the presence of photons in a box does not imply that the photons themselves have rest mass. Photons are massless particles that carry energy and momentum, but their energy does not contribute to the rest mass of a system.