Let X be the amount owned by James. The amount owned by Ali is X - $40.
The total amount owned by both of them X + (X - $40) = $250.
Combining like terms, we get X*2 - $40 = $250.
Adding $40 to both sides, we get X*2 = $290.
Dividing both sides by 2, we get X = $145.
#### 145