What do you mean by illegal? According to who? Like WTO or something? Genuinely asking, I don't know. I don't see how what they're doing is more illegal than paying corn farmers to make dumbass biofuel. But I don't know international trade law, hence the question.

the international legal standard for subsidies is based on the WTO's Subsidies and Countervailing Measures (SCM) Agreement and related anti-dumping regulation under GATT 1994.

In the US, it's implemented thru 19 U.S.C § 3571. The EU's foreign subsidies are regulated by Regulation (EU) 2016/1037 of the European Parliament and of the Council of 8 June 2016 based on the same WTO SCM Agreement.

While the WTO's regulations don't preclude local subsidy regulation, they must be consistent with the WTO's Agreement. In other word, any gov't subsidy favoring a "specific" company(ies) over domestic, foreign competitors, or distort market competition is an "actionable" offense and can be litigated before the WTO -- agriculture (quota based) and national security are however exempted. Others, such as export subsidies or local content requirement are prohibited under Article 3, "Prohibition" of the SCM.

Yeah, those evil corn subsidies. It's well to remember however that there is no international law against your gov't pissing away your tax payers hard-earned money -- so long as the product remains domestic and doesn't cause injuries to other trading partners.

That's your local political problem.