Consider the following claim:
Let $X \subset k[x_1,\dots,x_n]$ and $Y\subset k[y_1,\dots,y_m]$ be algebraic sets and suppose that we have a ring isomorphism $\varphi: \mathcal{O}_Y \to \mathcal{O}_X$. Show that the algebraic sets $X$ and $Y$ are isomorphic.
Now, I know that if $\varphi$ is an isomorphism of $k$-algebras, then $X$ and $Y$ are isomorphic. And I know that any isomorphism of $k$-algebras is also an isomorphism of the underlying rings.
Question: However, isn't it the case that not every ring homomorphism $\varphi: \mathcal{O}_Y \to \mathcal{O}_X$ is a $k$-algebra homomorphism $\mathcal{O}_Y \to \mathcal{O}_X$, and that only $k$-algebra homomorphisms $ \mathcal{O}_Y \to \mathcal{O}_X$ correspond to morphisms $X \to Y$, not arbitrary ring homomorphsims $\mathcal{O}_Y \to \mathcal{O}_X$?
In other words, which of the following two statements are correct? Are they even mutually exclusive? Or are they equivalent? If they are equivalent, why?
Two algebraic sets are isomorphic if and only if their coordinate rings are isomorphic as rings.
OR
Two algebraic sets are isomorphic if and only if their coordinate rings are isomorphic as $k$-algebras.
Context: My book, in sections 4.18 and 4.19, as well as this question on Math.SE implies that the first statement is true. However, section 4.8 of the same book, and every other source I have found (e.g. here or here), implies only that the second statement is true. Moreover, I was only able to prove the second statement, not the first. Which is correct?
This is a follow-up to my previous question, an attempt to show that the two statements are mutually exclusive and not equivalent. It was unanswered though, so I don't know if my attempt was successful -- for all I know, the two statements could be equivalent. If so, why?
EDIT: What I showed in my notes, and was agreed to be true in the comments is that:
There is a one-one correspondence between morphisms $X \to Y$ and ring homomorphisms $\mathcal{O}_Y \to \mathcal{O}_X$. (FALSE)
There is a one-one correspondence between morphisms $X \to Y$ and $k$-algebra homomorphisms $\mathcal{O}_Y \to \mathcal{O}_X$. (TRUE)