Retained earnings are not taxed per se. A company pays taxes on profits. Whether the profits are distributed to shareholders or retained makes no difference whatsoever as far as taxes are concerned.
retained earnings by definition are the accumulation of net incomes, and net income by definition is post tax
what went into the produce the retained earnings (profit) has been taxed
but the retained earnings themselves are not subject to additional taxation (with a few exceptions)