Does a capacitor in an inverting op-amp make a difference?
The gains of the two op-amp circuits you refer to are DC gains and, in simple circuit configurations apply across a range of frequencies up to a certain "limit".

The "limit" is usually (but not exclusively) the point where the op-amp can no longer sustain the desired gain and this may be due to parasitic capacitance on the circuit board, intentionally placed caps or internal capacitors within the op-amp.

This means the formula for the op-amp's gain is modified by a capacitor across R2 - this is an approximation but gives reasonable results. There are other places caps have an effect but normally, it's the feedback components that are generally affected first.

So, more realistically, any op-amp gain formula of the type you mentioned only holds true for DC and low/medium frequencies and if you were to be more accurate, the formulas would include effects of capacitance and, "normally" with op-amps this is the addition of a capacitor across R2.

At certain "higher" frequencies this capacitance will have the same magnitude of impedance as R2 and this is often referred to as the 3dB point of the circuit - this is the point at which the amplifier's gain falls to about 70% of what it was at much lower frequencies.

Capacitors are also commonly placed in series with R1 in order to minimize low frequency or DC effects. In this situation there is another 3dB point at a low frequency and that is when the impedance of the cap is the same magnitude as R1. As frequency lowers the cap becomes dominant and reduces the gain even more until at DC the op-amp has no gain.



The above diagrams are for inverting op-amp configurations.

Caps used intentionally in the described situations give the op-amp circuit the ability to pass a range of frequencies whilst attenuating others above and below the range - they are called band-pass circuits. If there is no cap in series with R1 but there is a cap in parallel with R2 this is a low-pass filter.