The total money is unchanged, so split it into 36 equal units. Before, Sam = 1⁄8 of Patrick = 1⁄9 of the total = 4 units. After, Sam = 1⁄3 of Patrick = 1⁄4 of the total = 9 units. Sam gained 9 − 4 = 5 units.
Plain numbers are given; italic underlined numbers are worked out.
Sam has $108 in the end.
Check: before Sam $48, Patrick $384 (1:8 ✓); after Sam $108, Patrick $324 = 1:3. ✓