Oct 15 (Reuters) - U.S. refiner Andeavor LLC agreed to pay $20 million in penalties to the Securities and Exchange Commission (SEC) for inadequate controls over a stock buyback plan it executed while it was in talks to be bought by Marathon Petroleum Corp in 2018.

The securities regulator said on Thursday that Andeavor's chief executive officer had directed its finance chief to initiate a $250 million stock buyback two days before the two companies were set to resume talks about a potential deal.

Andeavor's internal accounting controls failed to make sure the buyback adhered to a company policy prohibiting repurchases while it held material non-public information, the order said.

The refiner repurchased 2.6 million shares of its stock from investors at an average price of $97 per share in February and March of 2018, a month after which the two companies agreed to a deal valuing Andeavor at more than $150 per share.

Andeavor's parent Marathon Petroleum did not immediately respond to a request for comment. (Reporting by C Nivedita in Bengaluru; Editing by Devika Syamnath)