As far as I know, food industry is highly regulated in most if not all EU countries (clear list of ingredients, explicit list of food additives, calories per 100g/serving etc.).
From what I understand the problem isn't so much that the food is unsafe or that the ingredients, salt, sugar, calories, etc. would be incorrectly labeled, it's rather that that the marketing is misleading.
So if you'd buy, what looks like the same product, i.e. same name, same front side packaging, same presentation and so on, in two different countries you might actually end up with 2 different products. Because while the front page and advertisement might be identical, the list of ingredients might be different or differently ordered (usually the most used ingredients come first) or the calorie count might indicate it's a different product/composition.
Now there can be various reasons for why that is the case, from good faith localization, to lazyness to outright scams.
Like classic examples for localization might be that for example the Big Mac in India has obviously no cows involved. Or for export into Muslim majority countries companies would likely leave out the pork. Now in some cases it's pretty obvious that this makes it a different product, in other cases the product is named differently and in some cases it's subtle enough to call it the same but have it slightly adjusted to local taste.
So selling a product in localized versions doesn't have to be outright evil and malicious.
Another reason might be uniform marketing. Having to come up with hundreds of product names and ad campaigns is expensive. So probably companies rather have a short list of products and just one market wide ad campaign where localization happens in subtitles or dubbing rather than making a whole different version (unless the expected market revenue makes that profitable).
Another reason might be discrepancies in purchasing power in different countries, so if idk your fast food item costs the price of luxury dining, you're kinda in problem, because you're key demographic can't afford your products and the demographic that can, also has better options than what you're offering. So in order to appeal to the key demographic you'd need to cut the cost, i.e. by cutting corners in composition and advertisement.
Another point might also be the "snob factor". So while in Western Europe these products aren't really that special, in Eastern Europe they either weren't available at all, only through blackmarkets and more expensive or already as cheap knockoffs. So besides the content it might also serve as status symbol of "having made it", in terms of being able to afford the real deal and not the off brand version.
Which would be understandably infuriating if you find out that it's still a repackaged off brand version.
Which is a fairly common marketing stunt where you give a celebrity a premium version of your product and let them tell in great detail how awesome it is, to then dumb the market with a stripped down economy version that looks similar enough to be confused for the thing, but with significantly lower price and specs.
Another version might be that companies started by making supplying a demand for a product with a more affordable version raised the prices with the standard of living and hide their still inferior and now overpriced products with "localization", like "that's what people there are used to and changing the formula would just upset them".
Yet another version might be that they use it as a lab, so if people are fine with the more cost efficient composition, one might reformulate it in Western Europe as well to increase profit margins.
So TL;DR it's likely not illegal because they aren't technically lying about their content, their just hiding it and they can probably hide behind localization whether that claim is legitimate or not.
Though the real reasons might be interesting to investigate. Edit: Also as your first article claims, this can go to the extend that countries even pay more in comparison to their neighbors yet receive less quality. So that might be the answer to why that has become a political issues.