I will try to answer for them, I might be wrong but maybe you will understand how it might be working
They don't store with them the exact same battle with them, they just store the user inputs like time and location of your deployment, what troop did you deploy, time of your rally, etc. etc. i.e. all the data needed to re-create the battle. Now error can be because of couple of things: There is a bug in recreation code(traps, tower etc doing more damage than it should, due to some effects not getting applied less/more health for your troops in replay than actual), there is a bug in actual battle code(e.g. tower doing more or less damage than it should in the actual battle). Or there might be a bug due to which the input stored is wrong in itself. Or maybe the guy is actually cheating and there is some way in which he got what he shouldn't be able to get it.
In absence of proper frameworks to look into examples provided by players, it is really difficult to find out the exact cause or maybe they just don't care about the solution.
The only thing I can say for sure here is no one but them can say for sure why there is an difference between actual battle and replay.
Hopefully it clears a lot of doubts that you have