We can't actually say this. We don't know the full properties of Devil Fruits, as Oda said Vegapunk is gonna explain them some time in the future. It's fully possible that the supernatural qualities of Devil Fruit's aren't scientifically specific to the elements they exhibit. It's possible that the supernatural qualities is enough for rubber to be completely unaffected by that of lightning. It's a supernatural power, not exact real rubber and lightning.
This is even more obvious by the fact that, even though he's rubber, Luffy still heals like flesh, even though real rubber can't just "heal" from a hole, and from the fact that Enel's lightning never stopped anyone's hearts. Basically put, it's a fictional story, suspension of disbelief is a given, don't take everything at face value.