(Reuters) - The Congressional Budget Office said on Friday it was raising its estimate of the cost of the Troubled Asset Relief Program to $34 billion, primarily because of a drop in the market value of government investments in GM and AIG.

The new estimate is $15 billion more than the CBO calculated in its previous report.

But it is still "well below what was originally envisaged" when Congress created the $700 billion fund in 2008 to aid banks threatened by a rapidly unfolding financial crisis, it said.

The CBO's latest analysis reflects transactions completed, outstanding and anticipated as of November 15.

It estimated the cost of assistance to American International Group, aid to the automotive industry and grant programs aimed at avoiding home foreclosures at $59 billion.

However, the federal government will earn about $25 billion on other transactions it took to help financial institutions, reducing the cost of TARP to $34 billion, the CBO said.

In addition, only $428 billion of the originally authorized $700 billion will be disbursed under TARP, the CBO estimated.

"When the program was created, the U.S. financial system was in a precarious condition, and the transactions envisioned and ultimately undertaken engendered substantial financial risk for the federal government," it said.

"Nevertheless, the costs directly associated with the TARP, when taken in isolation, have been toward the low end of the range of possible outcomes anticipated when the program was launched," the CBO said.

That is partly because funds invested, loaned, or granted to participating institutions through the Federal Reserve and other government programs besides the TARP helped limit costs, the agency said.

(Reporting By Doug Palmer; Editing by Dan Grebler)