This is something my kids were taught and known to them as unit equalisation.
Important thing to note is that there was no loss of money in the before and after model. All movements of money were strictly between the 2 boys.
So in the before model, you get 5 boxes (B had 2, A had 1.5 × 2 = 3)
In the after model, there were 9 boxes (A had 4, B had 1.25 × 4 = 5)
Since the 5 boxes before represents the same amount of money as 9 boxes after, we take the LCM of 5 and 9 -> 45
So the 5 before boxes were 9u each for a total of 45u
and the 9 after boxes were 5u each also for a total of 45u
Hope this is clear?