Magnetoelastic influence on structural phase transitions in cubic ferromagnets