I buy stock for $100 and it generates a $3.00 dividend (which I claim as income) the first year. I then sell the stock @ $105. What income do I have to claim for taxes?

Something I've never understood about our tax law on the sale of securities--can you tell me if my understanding is correct, because it always felt like I was being taxed double (2X) for the same income. I know that mutual funds are treated differently--my question relates strictly to stock. 

Let's say I buy a share of stock for $100.00 and it generates a $3.00 dividend (which I claim as income) the first year. I then decide to sell the stock in year 2 (before any dividends are declared) and it's value is now $105.00. As far as the gov't is concerned, I earned $5.00 from my investment, which I must claim as income. But I've already declared $3.00 in dividend income, so in my mind, I should only be taxed $2.00 ($2.00 in appreciation + $3.00 in previously-declared dividend income). I know this is not the case, and I have to declare the total appreciation ($5.00) as income, but I feel like I'm paying tax twice on the $3.00 dividend income. Am I thinking this the right way--is this one of the "flaws" in our tax code?