It’s about price, cost, transportation, and scale. Grain (of a particular type) is mostly fungible but location and transportation are not. (A hectare of fresh water in New York is not worth the same as that same water is in Arizona, but it’s still just water) Ukraine exports about four times the amount of grain that Poland does. This is because Ukraine has much lower production costs. Which makes it more appealing to some other markets outside Europe particularly Africa. Some of those markets are now much harder to reach while exporting to Poland is still relatively easy. However importing cheap grain from Ukraine doesn’t reduce the cost to produce grain in Poland which is still to expensive to sell to those non European markets. But what it does do is put Polish farmers in a market they can’t compete against. This is why Poland is stopping imports of Ukrainian grain but still allowing the transit the grain.