I have 21 badges on Stack Overflow:
My profile shows I only have 19:
It's obviously not considering the fact that I have more than one of a certain badge (Caucus and Custodian). Tags are handled in a similar way. That is, by only counting unique entries:
However, the connotation between a total tag count is different between that and a total badge count, as the former is not displayed with your profile summary next to posts.
My suggestion would be to present a cumulative count for the badges on the profile page or perhaps include a distinction between unique and total badge counts.
Unrelated questions that all reference an inconsistency based on a different matter: