My question is, have they discontinued the night trains? And how can I purchase the overnight trains?
No, overnight train (Budapest-Prague-Berlin, "Metropol") is still running (and will be running next year). This problem with ticket purchase is old - Hungarian Railways (MAV) somehow don't won't to fix their module, so it will be possible to enter "Budapest" & "Prague" and get what you want.
Solution might be simply purchase ticket not to Prague, but one of the next stations on trains route (e.g. Usti nad Labem, Decin, Dresden) something like this -->
and then either get off earlier (in Prague) or indeed travel till the next station (Usti or Decin) & then come back to Prague (might make sense in case you don't want to get off in Prague at 4am)