Well, yes and no. The engines used in the Mazda5 are all part of the MZR L-series family, which shares its basic architecture with the Ford Duratec family. Displacements do range from 1.8 to 2.5 liters and date back to 2001. Mazda is a small company and can't afford the R&D budget of much larger companies that produce newer engines and engine families on a more frequent basis. Mazda got the MZR series by being partially owned by Ford, which helped fund the development of the four-cylinder family. All motors can be tuned to different powers for different purposes, and the way you measure the power has wiggle-room built into it. You'll notice that the SAE changed the way they allow manufacturers to rate horsepower and torque back in 2005, so that starting for 2006 models horsepower ratings sometimes fell. This also means it's difficult to compare post-2006 ratings with pre-2006 ratings too closely. The Duratec version of the 2.5 makes over 170 horsepower while the MZR2.5 in the gen2 Mazda6 makes 170 horsepower even, with 167 ft-lbs of torque. The same engine in the Mazda3 makes 167 hp, less than the Mazda6, but 168 ft-lbs of torque, more than the Mazda6. Not only could the tune be different, but the placement of the internal components, including the intake and exhaust tracts, will affect the power rating. The MZR2.5 in the CX-7 seems to be in different state of tune, making 161 hp and 161 ft-lbs of torque. I'm assuming this is to produce more low-end torque for the heavier weight and larger size of the CX-7 and to better appeal to drivers of similar vehicles in that segment. The MZR2.5 in the Mazda5, however, is rated for 157hp and 163 ft-lbs of torque. Given the similarities between the Mazda3 and Mazda5, and that the gen2 Mazda5 is really still based on the gen1 Mazda3, I would chalk up most of the power difference (167 vs 157 and 168 vs 163) to internal plumbing.
Why not "40 more HP"? Because it would require significant investment in an engine series Mazda didn't want to continue investing in, and couldn't afford to. Look at the Sky-G series. Even the brand new 2.5SG makes 185ish horsepower, only 15 more than the MZR's top tune.