When rendering overlapping meshes (I know this is bad practice, but in this case it is done purely out of curiosity) You get strange artifacts.
However, these differ from the viewport render and the F12 render:
Here is a screenshot of the viewport render in camera view:
And here is the render:
Why are these different?