* US Treasury directly buys pesos, Argentine markets rise * IMF involved in Washington talks on $20 billion swap line * Bessent insists Argentina aid is not a bailout, US won't lose money * Boost for Trump ally Milei in midterm legislative elections (Adds Bessent bailout comments, paragraphs 7-9) By Rodrigo Campos, David Lawder and Bhargav Acharya Oct 9 (Reuters) - The U.S. Treasury finalized a $20 billion currency swap framework with Argentina and bought pesos in the open market on Thursday, making good on President Donald Trump's pledge to prop up the wobbling country and sending the peso and Argentine dollar bonds sharply higher. "The U.S. Treasury is prepared, immediately, to take whatever exceptional measures are warranted to provide stability to markets," U.S. Treasury Secretary Scott Bessent said in announcing the actions on X. Argentina's 2035 bond rose 4.5 cents to trade at 60.5 cents on the dollar, while the peso closed at 1,418 per dollar, up 0.8% on the day after falling 3% earlier. Local stocks rose 5.3% Thursday. Last month they touched a 2025 low, days before Bessent's initial support pledge. Argentine stocks traded in U.S. exchanges rallied 13%. Bessent issued his statement at the end of four days of meetings with Argentine Finance Minister Luis Caputo that also involved officials from the International Monetary Fund, which has a $20 billion loan program with Argentina. A spokesperson for the IMF did not respond to a request for comment. A U.S. Treasury spokesperson declined to provide any further details, including on the amount of pesos purchased and how the $20 billion currency swap line would be structured. Bessent had previously pledged support for Argentina from the Treasury's $221 billion Exchange Stabilization Fund, and its majority holdings of IMF reserve assets known as Special Drawing Rights. Speaking later on Fox News Channel, Bessent insisted that the action was not a bailout, saying that no money was transferred to Buenos Aires and the ESF "has never lost money, it's not going to lose money here." He added that the assistance provided strategic U.S. benefits, including pledges by Argentina's right-wing president, Javier Milei, of "getting China out of Argentina" and its openness to allow U.S. companies to develop its rare earths and uranium resources. Democratic lawmakers in the U.S. Senate complained that Trump was moving to provide financing to bail out a foreign government and global investors, even as the U.S. government has been shut down. BACKSTOP FOR MILEI The backstop is partly aimed at giving Milei's party a boost in Argentina's October 26 midterm legislative elections. His party wants to strengthen its minority position to solidify his agenda to cut government spending and boost private-sector investment. Argentine lawmakers are working to limit what the president can do via decrees, raising the stakes for Milei's party in the midterms. Although the effect on financial markets was immediate, there was no guarantee the U.S. backstop will improve Milei's party's election prospects as public dissent over his austerity measures has grown. UBS's Shamaila Khan, head of fixed income for emerging markets and Asia Pacific, said the announcement was likely to bolster prospects for Milei's party. Kathryn Exum, co-head of sovereign research at Gramercy, said the midterms remain the major event, as are a policy and FX adjustment after the vote. Bessent called the success of Milei's reforms of "systemic importance" to the U.S. by helping to anchor a prosperous Western Hemisphere. 'CLOSEST OF ALLIES' Milei, who is due to meet Trump next week during the IMF and World Bank annual meetings in Washington, thanked Bessent and President Donald Trump in a message on X. "Together, as the closest of allies, we will make a hemisphere of economic freedom and prosperity. We will work hard every day to provide opportunity for our people," Milei wrote. Investors greeted the intervention with a sigh of relief. Eduardo Ordonez Bueso, emerging markets debt portfolio manager at BankInvest, said markets had been hungry for details of Bessent's support pledge and had been challenging peso valuations. "If they hadn't come through with a promise they made...we would be talking about a complete collapse of Argentina," he said. Several U.S. Senate Democrats introduced legislation that would prohibit the use of the Exchange Stabilization Fund to bail out Argentina and global investors. The measure is largely symbolic, as Democrats remain the minority in both chambers of Congress. "It is inexplicable that President Trump is propping up a foreign government, while he shuts down our own," said Senator Elizabeth Warren, referring to the partial government shutdown due to lack of funding. (Reporting by David Lawder, Rodrigo Campos Bhargav Acharya and Ismail Shakil, additional reporting by Andrea Shalal and Costas Pitas; Editing by Cynthia Osterman, David Gregorio and Shri Navaratnam) (The article has been published through a syndicated feed. Except for the headline, the content has been published verbatim. Liability lies with original publisher.)