I have a question on the basics of DFT, which bases on the Hohenberg-Kohn theorem: there exist an unique mapping between the external potential, the electronic wave function and thus also the electronic density n(r). In other words, from wikipedia, where ${\displaystyle v(\mathbf {r} )}$ is defined as an external potential,
"If two systems of electrons, one trapped in a potential ${\displaystyle v_{1}(\mathbf {r} )}$ and the other in ${\displaystyle v_{2}(\mathbf {r} )}$, have the same ground-state density ${\displaystyle n(\mathbf {r} )}$, then ${\displaystyle v_{1}(\mathbf {r} )-v_{2}(\mathbf {r} )}$ is necessarily a constant."
My confusion comes from the Kohn-Sham equations, i.e.
${\displaystyle v_{\text{eff}}(\mathbf {r} )=v_{\text{ext}}(\mathbf {r} )+e^{2}\int {\frac {\rho (\mathbf {r} ')}{|\mathbf {r} -\mathbf {r} '|}}\,d\mathbf {r} '+{\frac {\delta E_{\text{xc}}[\rho ]}{\delta \rho (\mathbf {r} )}},}$
${\displaystyle \left(-{\frac {\hbar ^{2}}{2m}}\nabla ^{2}+v_{\text{eff}}(\mathbf {r} )\right)\varphi _{i}(\mathbf {r} )=\varepsilon _{i}\varphi _{i}(\mathbf {r} ).}$
which was derived by decomposing the energy functional of the interacting-electron system into solvable energy functionals of a non-interacting electron system affected by an alternative external potential ${\displaystyle v_\mathrm{eff}(\mathbf {r} )}$, plus an exchange-correlation functional that attempts to account for the difference between the two systems. The optimal orbitals are obtained through this iterative scheme.
My question is, since the HK theorem states the unique mapping between between an external potential and the electron density / wavefunction, why would we obtain a common electronic state when ${\displaystyle v_\mathrm{eff}(\mathbf {r} )}$ - ${\displaystyle v_\mathrm{ext}(\mathbf {r} )}$ is not necessarily a constant?
${\displaystyle v_\mathrm{eff}(\mathbf {r} )}$ in this case is the external potential experienced by a single non-interacting electron defined by the first Kohn-Sham equation, while ${\displaystyle v_\mathrm{ext}(\mathbf {r} )}$ is the external potential exerted by the stationary nuclei to the electrons, in the electron-interacting picture.
I guess more specifically, I assumed that the KS method meant that we can solve a simpler system of non-interacting electrons affected by a specific ${\displaystyle v_\mathrm{eff}(\mathbf {r} )}$ that would give the same electron density of the same system but with interacting electrons.
However, the "external potential" governed by the interacting and non-interacting systems are different, so how come they will yield the same ground state, when we minimize their respective energy expressions?