I'm pretty sure they both use the same exact sensor, so I think you'd be hard pressed to see any difference.
The
white papers for the 40D say the sensors are actually different. The 40D's sensor is based on the 400D's, but the 40D's sensor had more improvements. Mainly, these improvements were to handle higher ISOs much better than the XTi.
The 40D white papers say: "Although the EOS 40D’s single-piece CMOS sensor is based on the Canon EOS Digital
Rebel XTi’s (400D ) sensor design and manufacturing technology, new processes were incorporated
in the CMOS semiconductor fabrication and microlens-forming process. By improving
light-collecting efficiency, the same ISO range and low noise (S/N ratio) as that of theEOS 30D were attained even though the pixels on the 30D are larger."
I believe the 400D has a 'crop' of 1.8X and the 40D is 1.6X so it might seem a little more wide. The quality won't change due to the lens though - you might notice a little less noise however at higher ISOs
The 400D and 40D both have a 1.6x crop factor.
I have to say, in owning the 40D, the biggest advantage (personally, for me) isn't the image quality, but the overall feel/appeal of the camera. I upgraded from the XT. Yes, the IQ is better on the 40D, but that wasn't the selling point for me.