DaveC426913 said:
I can intuit the answer but I can't formalize it.
So far nobody formalized it, so let it be me. Let me denote the mass on the left as ##m_1## and the mass on the right as ##m_2##. The corresponding gravitational potential energies are
$$V_1=m_1gz_1, \;\;\; V_2=m_2gz_2$$
where ##z## is the vertical position coordinate. The potential energy of the elastic spring is
$$V_{\rm spring}=\frac{k}{2}(L-L_0)^2$$
where ##L## is the length of the spring and ##L_0## is its length when no external forces act on it. Since ##L=const-z_1-z_2##, the total potential energy is the sum of all three potential energies
$$V=m_1gz_1 + m_2gz_2 + \frac{k}{2}(-z_1-z_2+c)^2$$
where ##c## is a constant. The forces on the first and the second weight are ##-\partial V/\partial z_1## and ##-\partial V/\partial z_2##, respectively. In the static case they vanish, so
$$ \frac{\partial V}{\partial z_1} = m_1g -k(-z_1-z_2+c)=0$$
$$ \frac{\partial V}{\partial z_2} = m_2g -k(-z_1-z_2+c)=0$$
Both equations can be simultaneously satisfied only if ##m_1=m_2##. In that case the two equations are equivalent, leading to
$$c-z_1-z_2=m_1g/k=m_2g/k$$
We see that the total elongation ##c-z_1-z_2## of the spring is as if only one of the weights with mass ##m_1## or ##m_2## was stretching it.