I don't know why it's less expensive to go via Luxembourg, but it is.
For the long stretches you probably want to take the ICE trains, because they are much faster. I went to Nuremberg last month via ICE in 3 hours; the RE trains would be multiple changes and 5+ hours. For ICE you need to buy direct (point to point) and reserve a seat (like flying). Trains that cross borders should also be direct, because the trains are individual country owned and run, and if you buy direct you shouldn't have to change trains. But, if you stay in Germany, and don't mind a longer transit time, the 49 Euro Deutschland Pass is a bargain. You are restricted to non-ICE trains (which includes IC, and IE), and don't have reserved seats, but will give you the opportunity to get off and on in places you never dreamed of stopping. It also lets you use the S Bahn in cities like Heidelberg. From Munich to Nuremberg, or Salzburg, you can use the Bayern Pass, and that allows you to use the U Bahn, S Bahn, trams, and busses. For two people that's 22-30 Euro/day.
The hotels I listed are not the most economical, but the locations are prime and you kind of pay for that. If you look around you can find cheaper places, but if you do that take a look at the subway and train lines and plan to use them. For instance, you can get a less expensive hotel up by the University in Munich and then use the U Bahn to get to the city center. (I used to do this. I had a pension I really liked, next to a great restaurant, but both have closed.)
I suggest you book your hotels before the end of August. Make sure you can cancel your reservations in case something happens, but get the places you want in Nuremberg and Strasbourg confirmed. Those two towns will sell out early. (Strasbourg also being the seat of the EU makes it more expensive also.)
Another thing to consider is that from Heidelberg you can easily hit some of the towns on the wine road like Neustadt (on the winestrasse), or Speyer, which may not be as big, but are very nice and beautiful towns. Those are only 30 minutes away, or if you go for an hours ride, you have Mainz or Bingen. (Bingen isn’t much of a market, but from there you can take the ferry across to Rudesheim and they have a nice small (international) market that is even running on Sundays.)