The answer is that it could be both. Muscle cramps are general caused by tired muscles, which is inevitable in distance running. They can also be caused by a sodium imbalance and dehydration.
Staying hydrated is a tricky proposition because there are so many variables that impact how much fluid and sodium you sweat out during your run. Intensity, fitness, heat, humidity and altitude are some of the things that will impact how sweaty you get. How much any body sweats can vary between ten to eighty ounces per hour!
That is a high amount of variability. The concentration of sodium in that sweat also varies greatly with an average concentration of about one-thousand milligrams per thirty-two ounces. In other words if you lose two pounds of sweat you may have also lose around one-thousand milligrams of sodium that needs to be replaced by drinking and eating sodium!
Of course these numbers are highly variable with the environment and individuality. Determining your sweat rate can be a useful tool in bench-marking how much sodium and fluid you need in different conditions. Sweat rate is determined by measuring how many pounds of fluid you might lose in different types of environments. You do this by weighing yourself before your run and then again right when you get back. For every pound lost you would need to replace it with sixteen ounces of fluid (roughly). You could then use this number as a benchmark for how much fluid per hour you should be drinking to replace sweat. If you are a salty sweater you then match about one thousand milligrams of sodium per hour from electrolyte drinks, salt tablets, and salted CLIF BLOKS. Of course this is always going to be dependent on you, as an individual but, practicing different scenarios in different environments can help you learn your personal best strategy for fluid and electrolyte balance under different environmental and physical circumstances.
If you are like me and always feel like you are in state of dehydration, you can head it off before your run by drinking .068-.14 ounces of water with salt per pound body weight two to four hours before your run.