check www.bahn.de
There are sometimes special offers for the night train to Budapest from Munich, I think with this special offer it was less than 50 EUR one-way. To get this special offer you need to book in advance over the internet.
Normal fare from Munich would be something around 110 EUR one-way, 10-20 EUR more from Memmingen. You could buy the train ticket right on the day of departure. Only for the night train you need a reservation in advance.
If you cannot get the special offer I would do the following:
Use Bayern-Ticket to get to Salzburg from Memmingen. Bayern-Ticket is a special ticket that allows unlimited travel on regional trains in Bavaria for one day. It costs 20 EUR if you are travelling alone. This is a good deal because it would cost you approx. 50 EUR to get to Salzburg from Memmingen.
From Salzburg take the train to Vienna, this will be around 45 EUR. Buy the train ticket in Salzburg from ÖBB (see www.oebb.at ) From Vienna you can get a special ticket to Györ (Euregio-Ticket) for 14 EUR. Buy the ticket at the train station in Vienna. From Györ to Budapest it will then be around 13 EUR, again buy the ticket at the train station in Györ (pay in HUF).
[ Edit: Edited on 13-Jul-2009, at 00:06 by t_maia ]