The fundamental frequency of a vibrating string is given by:
\[
f = \frac{1}{2L} \sqrt{\frac{T}{\mu}},
\]
where \( f \) is the frequency, \( L \) is the length of the string, \( T \) is the tension in the string, and \( \mu \) is the linear mass density.
The ratio of frequencies for the two cases is:
\[
\frac{f_2}{f_1} = \sqrt{\frac{T_2}{T_1}},
\]
where \( T_1 = 180g \, \text{and} \, T_2 = mg \).
Substitute \( f_2 = 50 \, \text{Hz}, f_1 = 30 \, \text{Hz} \):
\[
\frac{50}{30} = \sqrt{\frac{mg}{180g}}.
\]
Simplify:
\[
\left(\frac{50}{30}\right)^2 = \frac{m}{180}.
\]
\[
\frac{25}{9} = \frac{m}{180}.
\]
Solve for \( m \):
\[
m = \frac{25}{9} \cdot 180 = 500 \, \text{g}.
\]
Thus, the value of \( m \) is \( \boxed{500 \, \text{g}} \).