The sensor MUST be placed downstream of the heat input point. It DOES NOT matter what the temperature of the wort from the tun is. It only matters that you are heating the wort to your target temperature and not overheating it. Remember that the enzymes are in the wort, not the mash. If you try to control your heat input by observing the wort temperature coming out of the tun, you will likely severely overheat your wort as it passes through the heater. That will likely denature the wort enzymes and leave you with a starchy wort that does not ferment. (You don't have to ask how I learned that bone-headed lesson ;-) )
If you want to know the temperature of wort coming from the tun, insert an extra thermometer there.
+1 On Martin's explanation
When you place the sensor downstream of the heat source, the temperature WILL overshoot slightly and that will help to bring your tun up to ideal temp faster. Use a PID type controller, a RANCO does not react fast enough to keep the wort from overheating. As your wort gets closer to your programmed temp, the overshoot will become less and eventually stabilize withing .5 degrees or so. Also orient your rims tube so there will not be any bubbles or air pockets in the tube (Another lesson for another time!;-) )