Why does vertex merging cause non manifold geometry?
Your mesh contains flipped faces, which is considered non-manifold geometry.
It's probably not caused by merging vertices, and it's easy to repair

Select all faces
Go Mesh &gt; Normals &gt; Recalculate Outside
Done.

After this, there are still some non-manifold vertices on the outer rim, because the mesh isn't 'closed'.