Costs for food, housing and gasoline helped drive inflation to its highest level since 1981.