Yes, that can lead to deadlock. What if the lines are

  1  2  $100
  2  1  $100
If the first process locks account 1 then the second process locks account 2, the system is deadlocked.

It is easy to prevent deadlock. Require each processor to lock the two accounts in increasing order by account number. Then no deadlock is possible.