The following is an exercise in Hartshorne.
Let $ k $ be an algebraically closed field, $ Y $ an integral scheme of finite type over $ k $ and $ f : X \rightarrow Y $ a flat projective morphism whose fibers are integral. Suppose $ L,M $ are line bundles on $X $ such that for every $ y \in Y $, $ L_y \cong M_y $ on the fiber $ X_y $. Then there is a line bundle $ N $ on $ Y $ such that $ L \cong M \otimes f^* Y $.
The proof is standard: We have $ \mathcal{F}_y = (L \otimes M^{-1})_y \cong \mathcal{O}_{X_y} $ for every $ y $, and hence for every closed point $ y $ we get $$ \text{dim}_{k(y)} H^0 (X_y, \mathcal{F}_y) = \text{dim}_{k(y)} H^0 (X_y, \mathcal{O}_{X_y})=1 $$ So Grauert's theorem applies and we get $ f_* \mathcal F $ is locally free of rank $ 1 $ on $ Y $. We can show easily then that this is a suitable choice of $ N $.
My question (1): Does Grauert's theorem need the constant dimension hypothesis for closed points only? Because neither the theorem statement or the proof indicates that. I don't know how to get $ \text{dim}_{k(y)} H^0 (X_y, \mathcal{O}_{X_y})=1 $ for an arbitrary point $ y $.
This result gives motivation for studying families of line bundles, i.e. studying the Picard scheme. We can take $ Y = S $ and $ X = V \times S $ for a projective variety $ V $ and then a family of line bundles on $ V $ parametrized by $ S $ is just a line bundle $ \mathcal L $ on $ V \times S $. And the exercise is the reason why the Picard functor is defined as $ \text{Pic}_V(S) := Pic(V \times S)/p^*Pic(S) $ where $ p : V \times S \rightarrow S $ is the projection.
My question (2): What if $ V $ is not a variety? Is the Picard functor representable for a non-reduced $ V $ say? (For non-singular varieties $ V $ it is.) What if $ k $ is not algebraically closed?