Let $X$ be a smooth projective variety, $A$ a complete discrete valuation ring, $Y=\mbox{Spec} A$ and $f:X \to Y$ a smooth, projective, surjective morphism. Denote by $y$ the closed point of $Y$. Let $\mathcal{L}$ and $\mathcal{M}$ be two line bundles on $X$ such that its restrictions to the fiber $X_y$ over $y$ are isomorphic, i.e., $\mathcal{L}\otimes \mathcal{O}_{X_y} \cong \mathcal{M} \otimes \mathcal{O}_{X_y}$. Does this imply that there exist a line bundle $\mathcal{N}$ on $Y$ such that $\mathcal{L} \cong \mathcal{M} \otimes f^*\mathcal{N}$?

Note that this is in some sense a generalization of Ex. III.12.4 of Hartshorne, "Algebraic Geometry".