$170
===============
Let's assume Sam had x dollars at first.
James had $240 more than Sam, so he had (x + 240) dollars at first.
After their mother gave James $30 and Sam $50, James had (x + 240 + 30) dollars and Sam had (x + 50) dollars.
According to the given information, James had twice as much money as Sam after receiving the money, so we can write the equation:
Simplifying the equation, we have:
Subtracting x from both sides, we get:
Subtracting 100 from both sides, we get:
Therefore, Sam had $170 at first.