Suppose I have two agents with utility functions $U_i$ and $U_j$ and budgets $p_x x + p_g g = m_i$ and $p_y y + p_g g = m_j$.
If I solve a social planner UMP, I will get for my g FOC (after plugging in the other FOCs)
$$ p_x MRS_i + p_y MRS_j = p_g$$
If I assume $p_x = p_y$ then I have after rearrangement
$$MRS_i + MRS_j = MRTS =\frac{p_g}{p_x} $$
But suppose $p_x \neq p_y$. Does the Samuelson condition hold?
As I wrote the question, I noticed the following:
I can see one would write for $n$ agents
$$\sum_{i} p_{x_i}\frac{MU^i_g}{MU^i_{x_j}} = p_g$$
Now we can write that as
$$\frac{MU^i_g}{MU^i_{x_i}} + \sum_{j\neq i} \frac{p_{x_j}}{p_{x_i}} \frac{MU^j_g}{MU^j_{x_j}} = \frac{p_g}{p_{x_i}} $$