If you go to a grocery or bulk-foods store and get several similar items that have the same price such as different flavors of the same brand of chips, different styles of the same brand of canned-soup, etc. you may have wondered why the cashier has to scan each one separately instead of just scanning one and multiplying by the number, or for bulk-foods, keying in one item and weighing them all together. There are actually a couple of good reasons for this.
By scanning each item with a unique barcode separately, they can keep track of inventory without having to manually check the shelves. This makes it easier for them, which means less work, which means lower prices (or at least in theory). If they scan one UPC for multiple different items, then their inventory will be incorrect and they will order too much of something they already have and not enough of something they need.
Just because items are similar doesn’t mean they’re identical. It’s entirely possible for one flavor of soda to be more expensive than the others or one kind of socks to be on sale, and so on. If they scan one item multiple times for all of them together, then they could end up over- or under-charging you.
It’s necessary for cashiers to scan each item separately, but it’s only necessary for each unique item; if you get more than one of the same item (e.g., same item-code/UPC), then they can scan one multiple times.