The 3.0l M52 wasn't used in E46s after 2001. The 3.0l M54 replaced it through the end of the E46 model run in the US. The 2006 E90 used the 3.0l N52 motor. There were substantial engineering improvements (materials, valve train, fuel injection, etc.) made in both M54 and N52 engines that go way beyond intake, exhaust, and software to account for the differences in power.
Typo - I meant N52 and that should have been obvious. In the e90 model line, there weren't any significant differences between the 325 and the 330 motor. BMW basically dumbed down the output by changing the intake manifold, putting in a more restrictive exhaust as well as different software. They even have the same ecu.