In the game between Spain and Russia, in the World Cup 2018, one Russian defender (Ignashevich) tackled a Spanish player (Ramos) inside the Russian penalty area (video here or here). This was technically a foul, and thus a penalty for Spain. However, right after the tackle, the ball hit Ignashevich and entered the Russian goal. Thus, it was an own goal.
Now, in terms of timing, the foul happened before the goal. Thus, why is a penalty not given? Why give the goal to Spain, instead of giving them the chance to score, but without 100% probability of doing so? Surely, if the time difference between the foul and the own-goal had been longer, the referee would have given the penalty. But if so, isn't this just an arbitrary application of the rules?
Update (based on comment asking for more info):
Why would the foul be given before the goal awarded? Because technically, the foul happened first. You can think of the strict rule being something like "IF foul, THEN penalty", whereas in practice it seems more like "IF foul AND goal AND goal-foul > epsilon, then penalty". Thus, only if the time difference is long enough would the penalty be given. But if epsilon is small enough (so the goal happens just after the foul), then the goal is given. This seems to me arbitrary. Sure, there are technical limitations involved in the referee (e.g. when epsilon is too small, the referee has little capacity to react in time). But the current approach seems to be based on assumptions by players that, if a goal happens after a penalty foul, it will be awarded. Maybe the VAR can precisely help to reduce the arbitrariness of rules like this.
What happens next - including how long it happens - should not make a single difference to the decision!
You have to look at the intent of the Law, not the algorithm. The point is to punish the offending team. Often, a team would benefit more from the punishment that the current state of the game. They shouldn't be able to benefit from a foul. Hence, the "advantage rule". Not applying it would lead to the offended team being punished after receiving a foul, adding insult to injury. It could make sense, though, to add the foul consequence AFTER the goal, like basketball does