Solution (source code)

= Solution

Assume positive deterministic initial stock prices and finite, positive terminal <variances>, as required to define the <correlation coefficient>. The explicit stochastic-exponential solutions with constant volatilities give
$$
\frac{S_t}{S'_t}=\frac{S_0}{S'_0}\exp\left[(\sigma-\sigma')B_t-\tfrac12(\sigma^2-(\sigma')^2)t\right].
$$
The common, possibly random, accumulated interest rate cancels. If $\sigma=\sigma'$, this ratio is a positive constant, so the prices are perfectly correlated.

Conversely, perfect correlation would give $S_t=cS'_t+d$ almost surely for constants $c>0,d$. If $\sigma\ne\sigma'$, the displayed ratio is a nonconstant variable with a <lognormal distribution> with full support $(0,\infty)$. If $d>0$, the ratio would always exceed $c$, and if $d<0$ it would always be below $c$, both impossible. If $d=0$, the ratio would be constant, also impossible. \b[Therefore $\boxed{\rho(S_t,S'_t)=1\iff\sigma=\sigma'}$], whenever the stated terminal <variances> exist and are positive. No deterministic-interest assumption is needed. Degenerate terminal prices, for example zero volatilities and deterministic rates, have undefined correlation and must be excluded.