That's possible. However, $30 both ways still sounds incredibly cheap.
Maybe your friend was able to get some sort of a very special discount
on the tickets?
Ordinary train ticket, 2nd class, from Gdańsk to Warsaw (both ways)
costs 120PLN (that's over $40) so it would be odd if Intercity ticket
to Budapest was cheaper than that.
We were visiting students at the time, and I did have to present my legitymacja so I think there could be a student discount. That was a year ago in October. You're right that a Budapest ticket should cost more than a Gdansk ticket - but it should not be *that* expensive i.e. 405zl.