Usually, no. With many, the chamber section of the 9mm is slightly narrower than the chamber of a 40.
So, Going from a 40 down to a 9mm with factory barrels, there will be a slight amount of 'slop' (but not enough to get anyone's panties in a wad), while going with aftermarket barrels, the fit would be optimal. The 40 Chamber though, would not fit into a 9mm slide without first doing some grinding. It's too wide for the 9mm Slide.
The other factor seems to be the extractor fit. The 9mm base diameter is a bit smaller than the forty, but again, not so much so that the 40 extractor can't get a decent bight on the 9mm case. If you could get a .40 barrel into a 9mm slide, the 9mm extractor would have a tough time getting a good bight on the .40's case.
I hope I explained it properly. My knowledge comes from reading the dozens of 'Conversion' threads on the forum, as opposed to actually trying it. If I didn't explain it correctly, I'm certain someone will correct me.