US consumer prices surged to a 40-year high, defying expectations that gains would start to moderate after the Federal Reserve began tightening.