Proof (morphism and pullback preserving local rings)
Morphism $\implies$ pullback preserves local rings
Obvious from definition: suppose $f$ a morphism and let $ϕ = g/h\in O_{Y,f(x)}$ where $h(f(x)) \neq 0$. Since $f^\ast: A(Y)\to A(X)$, certainly $f^\ast g/f^\ast h\in k(X)$. We also have $h(f(x))\neq 0$, so $f^\ast g/f^\ast h \in O_{X,x}$.
Pullback preserves local rings $\implies$ morphism
Write $y_1, \ldots, y_n$ for the coordinates of $Y$.
For any $x\in X$, since $y_i = y_i/1\in O_{Y,f(x)}$, by hypothesis $f^\ast y_i\in O_{Y,f(x)}$. This holds for all $x$ so $f^\ast y_i\in A(X)$. Therefore $f = (f^\ast y_1, \ldots, f^\ast y_n)$ is a morphism $X\to Y$.