Answer
passenger train: $60$ mph
freight train: $40$ mph.
Work Step by Step
distance = (rate)$\times$(time) $\Rightarrow$ time = $\displaystyle \frac{\text{distance}}{\text{rate}}$
Let x be the rate of the passenger train.
The rate of the freight train is $x-20.$
We are given: time = $\displaystyle \frac{240}{\text{rate of pass.train}}$ = $\displaystyle \frac{160}{\text{rate of freight tr.}}$
That is,
$\displaystyle \frac{240}{x}=\frac{160}{x-20} \qquad$ ... $/\times x(x-20)$
$240(x-20)=160\cdot x \qquad$ ... distribute...
$ 240x-4800=160x \qquad$ ... add $4800-160x$
$ 80x=4800 \qquad$ ... $/\div 80$
$x=60$ mph
... is the rate of the passenger train, and the freight train's is $40$ mph.