Confused about Op Amp
Both statements are correct, but you are apparently confusing things. The first statement is what values may the output actually achieve and that is indeed limited by the power rails.

What the output will achieve in a particular circuit will (provided there is negative feedback) be somewhere between the power rails such that the difference between the inputs is zero, provided it is possible for the output to achieve it.

Consider the circuit below:







simulate this circuit &ndash; Schematic created using CircuitLab

This amplifier has a non-inverting gain of 2. If we set Vin to be 2V, then the output can go to 4V, keeping the inverting input at the same 2V, but if we were to set Vin to be 3V, an output of 6V cannot be achieved; the maximum is 5V (in a practical device this may not be achievable, but I will leave that alone for now).

With 5V at the output, the inverting input cannot be higher than 2.5V, leaving a differential voltage between the inputs.