WASHINGTON (Reuters) - Government-controlled mortgage firm Freddie Mac (>> Federal Home Loan Mortgage Corp) said on Thursday it will pay $30.4 billion (18.9 billion pounds) in dividends to the U.S. Treasury after a multibillion-dollar tax-related windfall fuelled a record profit in the third quarter.

The report from Freddie Mac, which recorded pre-tax income of $6.5 billion, came on the same day its larger sibling and fellow state ward Fannie Mae said it would be making an $8.6 billion dividend payment to the government.

Fannie Mae (>> Federal National Mortgage Association) said rising home prices helped push its net income to $8.7 billion for three-month period that ended September 30.

Taking into account a decision to write up nearly $24 billion in tax-related assets, Freddie Mac's net income for the period was $30.5 billion.

The latest payments to the U.S. Treasury from the two government-controlled companies will nearly erase the net cost of their $187.5 billion taxpayer-funded bailout. In return for the aid, the companies are required to sweep most of their profits into the Treasury.

When Freddie Mac makes its dividend payment in December, it will have returned all of the $71.3 billion it received in taxpayer aid, and an additional $9 million.

Fannie has received $116.1 billion from the Treasury, and it will have sent $113.9 billion in dividend payments to the Treasury by December.

By early 2014, taxpayers likely will have turned a profit on the bailout of the two housing finance giants, which own or guarantee about two-thirds of all U.S. home loans.

But under their bailout terms, their debt to taxpayers cannot be repaid and they will continue to make dividend payments as long as they are profitable.

(Reporting by Margaret Chadbourn; Editing by Andrea Ricci)

By Margaret Chadbourn