Another explanation is that your body is learning to store carbohydrates as fuel (glycogen) for your long runs. Those glycogen stores are important to completing your long runs and marathon without "hitting the wall", but you may see a couple extra pounds on the scale on certain days. Your body also requires additional water to break down and store the glycogen, so that will also add extra weight.
Also, you may have been increasing your calorie intake without realizing it. Keep in mind that running a lot does not give you carte blanche to eat whatever you want. The basic principle for weight loss still applies: You must burn more calories than you consume. To lose a pound, you have to burn, through exercise or life functions, about 3600 calories.
With all the calories you burn by running, some people are surprised when they don't lose weight during marathon training, but they forget that they're inhaling a quart of ice cream and a dozen Oreos for a snack after their run. Make sure you stock your kitchen with healthy foods, so when the "post-run hungries" hit, you'll be prepared with nutritious foods, not empty calories. It's normal to feel hungry when training for a marathon. Just try to avoid mindless eating and stick to healthy foods and snacks.
It's also helpful to track your food intake in a training journal. It will make you think twice about the foods you're putting in your mouth and also help you figure out what foods work best for you.
Another area where long distance runners get into trouble is drinking too many calories. Just because you're training for a marathon doesn't mean that you need to constantly drink sugary sports drinks. While it's important that you replace electrolytes during your long runs, you don't need to constantly have a sports drink at your fingertips the rest of the time. Stay away from fruit juices and regular soda since they also add a lot of calories to your diet, but don't make you feel full. Plain water is fine for staying hydrated during the week.
If you've been eating a nutritious diet and you still find that you're gaining weight, try not to focus too much on that number on the scale. It could be inaccurate since our weight does fluctuate depending on what time of the day or month we weigh ourselves. Pay attention to other measurements such how your clothes are fitting, how toned you feel, body fat percentage, or inches lost. And if you really want to lose weight, remember that healthy weight loss takes time. Even with all the running that you're doing, you should not aim to lose more than a pound a week. So, try to be patient.
Also see: How to Avoid Post-Marathon Weight Gain