Think of it like this: Gain is only the ratio between input voltage and output voltage. Your goal is to set the gain as high as possible - to the highest voltage without clipping or distortion.
Not going to go into great detail, but for the sake of explanation:
Box rise is a change of impedance across a frequency range. And power is V2/R. To tie it together: You hold your amp's voltage (gain) constant. Your box rise will change based on a given frequency, and when your ohm load changes, so does your power output, in accordance with the equation above. Higher box rise = less power output.