It's the design of the bogies!
WAP7 locos have Flexicoil Mark IV type bogies (also used in WAG9). This type of bogie has a flat bogie frame (like ICF coaches). Also, it's a 3 axle wala bogie. Because of such a structure, it has a longer wheelbase and there isn't space to hang the motors. It's understandable as WAG9 was built for freight operations up to 120 km/h max and we have re-geared it to make WAP7.
WAP5 locos, on the other hand, have Bo-Bo type bolsterless Flexifloat bogies (Henschel Flexifloat) which...
more... is Y-shaped (very similar to the FIAT bogies used in LHB coaches. Due to this bogie structure (also with fewer axles), there's space to hang the traction motors on the underframe of the loco rather than the axle. The aim here was to reduce the unsprung mass of the loco so as to improve the loco's ability to zip through curves (our tracks are curvy-wavy anyways :P) and to reduce the impact on rails, especially at high speeds.