U.S. inflation rose to a four-decade high in June due to rising prices in gas, food and rent, according to data by the Labor Department.