This configuration is extremely interesting and basic for a class of analog circuits. That is why I prepared this story illustrated by numerous experiments.
Basic idea
It is a little "algebraic":
First we decrease the quantity X with a varying coefficient K (0 ÷ 1), then we increase it twice and subtract from it the input quantity X:
X -> K.X -> 2K.X -> 2K.X - X -> (2K - 1).X
Thus, for three typical values of k (0, 0.5 and 1), we obtain a gain of -1 (inverter), 0 ("zeroer") and 1 (follower).
Common-mode differential amplifier...
We can see this idea in the classic 4-resistor op-amp differential amplifier when two equal input voltages Vin1 = Vin2 are applied (the so-called "common mode")...

simulate this circuit – Schematic created using CircuitLab
... with a common input voltage source...
... by replacing the two input sources with only one common source Vin; hence the name "common". Here this situation is undesirable and must be suppressed (the output voltage must be zero). Therefore, K = 0.5 is chosen for the circuit to work as a "zeroer". Thus we get the famous circuit with four identical resistors. For simplicity, in the schematic below, I have used the favorite resistance value of 1k and voltage 1V.

simulate this circuit
As we can see in the graph below, when we change the input voltage (for example, from -1 V to 1 V) by the help of the CircuitLab DC sweep simulation, the output voltage stays zero since the circuit is balanced.

... with a variable non-inverting gain
But there is a very powerful inventive principle that
can be figuratively called "turning harm into good". In fact, we widely use it in life; there are even such proverbs, "When life gives you lemons, make lemonade":-)
So, if we replace the resistors R3 and R4 with a potentiometer P and start changing its K in one (K > 0.5) or the other (K < 0.5) direction, the differential amplifier will be deliberately unbalanced and its output voltage will change when the input voltage varies. Thus we will get a non-inverting or inverting amplifier.
So this "new" type of amplifier is an unbalanced differential amplifier.

simulate this circuit
I have set the pot ratio K (wiper position) as a second parameter with a step of 0.2 in the DC sweep simulation. When K = 0, the circuit is an inverter (blue curve below); when K = 1, it is a follower (brown).

... with a discrete non-inverting gain
R4 -> switch. If we replace R4 with a switch, the circuit will work in its two extreme states.
Odd voltage follower (gain 1)
SW open. When the switch is open a very strange configuration is obtained. The non-inverting input is connected through R3 to the input source and the left terminal of R1. The inverting input is connected to the right terminal of R1. Thus the op-amp is forced to maintain zero voltage across R1. For this purpose, it keeps its output voltage equal to the input voltage, i.e. it acts as a (really, quite odd) voltage follower.

simulate this circuit
There are two unique phenomena in this arrangement:
- The voltages at all points are the same
- No currents flow
So this is an equipotential and no current circuit.
In the picture below, the two graphs (of the input and output voltage) are on top of each other and only the upper one (of the output voltage) is visible.
This will also happen in other pictures below.

R3 -> piece of wire. Since practically no current flows through R3, it can be replaced with a piece of wire and the circuit simplified. But it looks no less strange than before. It is an "inverting amplifier" that keeps the voltage on its virtual "ground" equal to the input voltage... and as a result it has become a follower.

simulate this circuit
Graphical results are exactly the same and confirm this.

R4 -> small capacitor. We are now getting closer to answering the OP's question. So, if we replace R4 with a small (only 10 pF) capacitor, nothing will change; the voltage at the non-inverting input will be equal to Vin again.

simulate this circuit
Let's first see it in the DC sweep simulation (ramp input voltage)...

... and then in the time domain simulation (sine input voltage). I remind you that the two graphs are on top of each other.

Classic inverting amplifier (gain -1)
SW closed. The non-inverting input is connected through to ground. R3 is in parallel with the input source and does not play any role. So the circuit is an inverting amplifier...

simulate this circuit
... as you can see from the graphs.

We can remove R3...

simulate this circuit
... and it does not affect the graphs.

R4 -> big capacitor. If we replace R4 with a big enough (1000 µF) capacitor, the non-inverting input will be actually grounded and its voltage will be zero. The circuit will be inverter as above.

simulate this circuit
I have used CSV source and time domain simulation since the DC sweep simulation does not work well.

And finally, let's examine the circuit in the classic way using a sine signal.

simulate this circuit
As you can see, it acts as a perfect inverter again.
