Automaker General Motors (NYSE:GM) is getting itself out of hock with the UAW.

On Monday, GM announced that it has agreed to buy back from the UAW Retiree Medical Benefits Trust (UAW VEBA) 120 million shares of its Series A Preferred Stock. At a purchase price of $27 per share, this amounts to total cash consideration of $3.2 billion. If successful in this buyback, GM will retire approximately 43% of the 276 million Series A Preferred shares that UAW (and Canada Holdings) hold in trust for the payment of GM retiree medical benefits -- and the UAW VEBA will have much more cash with which to pay these benefits.

The trust got the shares after GM emerged from bankruptcy, to help pay the company's retiree health care costs.

UAW VEBA and Canada Holdings, in turn, will be losing the generous 9% annual dividend payouts that these preferred shares have been generating for them. On the plus side, GM will be paying a $2 premium to the shares' $25 "liquidation preference" price.

GM intends to pay for its repurchase by selling the senior unsecured notes -- essentially, taking on debt to raise the cash it needs. This week, GM will be attempting to sell senior unsecured notes maturing five, 10, and 30 years from now, to raise the needed cash.

The company will take an $800 million charge to earnings in Q3 in connection with this preferred share redemption.

-- Material from The Associated Press was used in this report.

Fool contributor Rich Smith has no position in any stocks mentioned. The Motley Fool recommends General Motors. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.