Cessna 172/182: Should I set the tank selector to the R.H. tank after parking the airplane?
The C172S manual I have says to set the selector to left or right as part of the "securing airplane" checklist:


  
  Fuel Selector Valve -- LEFT or RIGHT to prevent cross feeding
  


I was also taught to set it to right during my initial training. The idea is to prevent cross-contamination or leaks if one tank is compromised. Another reason is that if you park the aircraft on a slope, you could end up with an imbalance between the tanks, as you said. 

So the POH confirms that it prevents cross feeding, at least in that model: you should always check the POH for your specific aircraft.