Checking the origin of the code is a standard step in any acquisition process (I have been involved in several). It's reasonable that people do not want to pay for some code that they later discover has to be released as source. The general attitude is "trust, but verify".
As you say, there might be a case where two independent implementations came up with the exact same code, although the probability of this is reduced exponentially with the size of the exact match. Keep in mind, we do not talk about "i = 0;" here, but something longer. And we do not discuss examples matching the official documentation, because then you can point to it as origin, instead of SO -- and it would probably be under a better license.
The questions are: even if you wrote it yourself, do you justify the costs of potentially going to court to defend the case and are you sure you will convince a judge, who will be the person making the decision?