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.
They are taxed; they are taxed because they are a subset of profits, which is a taxed category. They are not taxed more than other profits, but that doesn’t mean they’re ’not taxed’.