Not sure if it's the case in the USA, but here in the UK it seems to be that AAA and AA batteries cost exactly the same, and that offends me. Why should I pay the same for half the storage capacity? Is it price fixing?
I think more likely it's that the cost of materials is a pitiful fraction of the total cost. It takes just as many workers and machines to make a smaller battery, and they travel in the same lorry to the shop
I'm going to speculate based on my experience with manufacturing & distribution.
The physical process to make a AA and a AAA is the same. The same machinery, using the same range of slightly difference size parts, and pretty much the same number of units per hour produced.
The storage & distribution will also be very similar so much of those costs will be the same. Yes the AAA is smaller and lighter so there will be some cost differences, but it's not like an AAA vs D.
Much of the final cost will be in the retail side of the business where the cost of processing a sale of AA and a sale of AAA is the same.
I do agree with you though, it's a little grating.