Hartshorne Lemma II.5.3 Proof
I am clarifying further the crucial point raised in the comments to @hwong557's answer.
Let $(f,f^\#): (X,\mathcal{O}_X) \rightarrow (Y,\mathcal{O}_Y)$ be a morphism of locally ringed spaces. Suppose that $f(X)$ is open in $Y$ and that $f$ induces an isomorphism $\big(X,\mathcal{O}_X\big) \rightarrow \big(f(X),\mathcal{O}_Y|_{f(X)}\big)$ of locally ringed spaces. Hence, we have an isomorphism of sheaves $\mathcal{O}_Y|_{f(X)} \cong f_*\mathcal{O}_X$. Moreover, for every open set $U$ of $X$ we have an isomorphism of rings $\mathcal{O}_Y(f(U)) = \mathcal{O}_Y|_{f(X)}(f(U)) \cong f_*\mathcal{O}_X(f(U)) = \mathcal{O}_X(U)$.
Now let $\mathscr{G}$ be an $\mathcal{O}_Y$-module. Let us look at the sections of the presheaf that gives rise to $f^* \mathscr{G}$. Let $U$ be open in $X$. Then the sections of that presheaf over $U$ are $f^{-1}\mathscr{G}(U) \otimes_{f^{-1} \mathcal{O}_Y(U)} \mathcal{O}_X(U)$. But $f^{-1} \mathcal{O}_Y(U) = \lim_{V' \supset f(U)} \mathcal{O}_Y(V') =\mathcal{O}_Y(f(U))$, and we already know that this latter ring is isomorphic to $\mathcal{O}_X(U)$. Hence, $f^{-1}\mathscr{G}(U) \otimes_{f^{-1} \mathcal{O}_Y(U)} \mathcal{O}_X(U) \cong f^{-1}\mathscr{G}(U)$. This now shows that $f^* \mathscr{G}$ is the same as $f^{-1}\mathscr{G}$, and the latter is by definition $\mathscr{G}|_X$.
Let $\phi: Spec (A_g) \to Spec (B)$ be the inclusion map. Then:
$$\mathcal F\mid_{D(g)} = (\mathcal F\mid_{V})\mid_{D(g)} = (\tilde M) \mid_{D(g)} = \phi^*(\tilde M) = (M \otimes_B A_g)^\tilde{} $$