An ideal opamp has infinite gain. It amplifies the difference in voltage between the + and - pins. Of course in reality this gain is not infinite, but still quite large.
The output of the opamp (at to some extents the input also) is constrained by the power supply, we can't get out more than the supply puts in.
If we simply put signals into the opamp without feedback it would multiply them by infinity and get a binary output (it would saturate at the supply rails)
So, we need some way of controlling the gain. That is what the feedback does.
The feedback (DC as well as AC) takes part of the amplified output from the input, such that the gain is constrained much more by the feedback network, which is predictable, and much less by the massive (and unpredictable) open loop gain.
Even in an AC only circuit we still need feedback that works at DC (zero Hz) or the gain would be only that of the open loop for DC signals. You AC signal though constrained would be swamped by the DC open loop gain.
The transfer function of the inverting amplifier is
\$ V_{OUT} = -\dfrac{R_{feedback}}{R_{in}} \cdot V_{IN} \$
For the non-inverting amplifier it is
\$ V_{OUT} = \left(1 + \dfrac{R_{feedback}}{R_{g}}\right) \cdot V_{IN} \$
where \$R_g\$ is the resistor to ground.
So the gain is determined by a resistance ratio, where a higher feedback resistance gives a higher gain. About the choice for higher or lower resistance values: lower is better, because at higher resistances the input bias current may begin to play a role. But don't overdo it: if your inverting amplifier would have a 1 kΩ feedback resistor and you want a gain of 10 \$\times\$, then the input resistance should be 100 Ω, and that may be a bit too little for the signal source. So see how much current the source can supply, and calculate the feedback resistor from that.
The non-inverting amplifier doesn't have that problem: the input signal feeds directly to the high impedance of the non-inverting input. To minimize offset error you'll have to make the input impedances for both inputs equal, that means on the signal input a series resistance equal to \$R_{feedback}\$ and \$R_g\$ in parallel. Example: if the feedback resistor is 10 kΩ and \$R_g\$ 1 kΩ then place a 9.1 kΩ in series with the source.
By the way, that equal impedance rule also goes for the inverting amplifier. You'll often see the non-inverting input directly connected to ground, but again placing a resistor between the input and ground will reduce offset error. Again the resistance is the parallel of the other two resistors.
Best Answer
The circuit is an integrator and in the absence of an input voltage, the op-amp output should stay held at the voltage it acquired prior to the input becoming zero. However, nothing is perfect and the op-amps input imperfections will tend to push or pull the output towards either power rail (but slowly). To this end, the 10 Mohm resistor will try and counter that by discharging the capacitor slowly. Now the op-amp output will gradually drift back to centre-rail.