Retirement tax questions

Would that be double paying tax.  For instance: Suppose the proceeds minus costs are reported on your taxes and you pay taxes on the gain (ex: 10k), but you don't actually take your gain ourt and it gets re-invested.  Years later, you decide you want that gain (10k), wouldn't you be paying taxes on it when you take it out.  You will get a 1099 distribution.

 

That would be double paying tax