Let the rate of the boat in still water be \( b \) mph. The speed of the boat against the current is \( b - 3 \) mph, and the speed of the boat with the current is \( b + 3 \) mph.
Let \( t \) be the time taken to travel the distances. We can set up the following equations for the time taken to travel 10 miles against the current and 40 miles with the current:
\[ t_{\text{against}} = \frac{10}{b - 3} \] \[ t_{\text{with}} = \frac{40}{b + 3} \]
According to the problem, these times are equal:
\[ \frac{10}{b - 3} = \frac{40}{b + 3} \]
We can cross-multiply to eliminate the fractions:
\[ 10(b + 3) = 40(b - 3) \]
Expanding both sides gives:
\[ 10b + 30 = 40b - 120 \]
Now, we will rearrange the equation to isolate \( b \):
\[ 30 + 120 = 40b - 10b \] \[ 150 = 30b \]
Now, we divide both sides by 30:
\[ b = \frac{150}{30} = 5 \]
Thus, the rate of the boat in still water is \( \boxed{5} \) mph.