Answer:
The Bureau of Labor and Statistics researches or "calls around" if you will to find out the price of one same item at different merchants. They take all the prices they got, average them, and then compare them to last year's results.
I believe the CPI is calculated by the Department of Labor using price surveys taken in 87U.S. cities.
For all questions concerning the CPI refer to the Related Link below.