The ratio of the number of pencils to the number of pens John bought was 3:2. Each pen cost $9 while each pencil cost 1/3 as much as a pen. He paid a total of $108 for all of them. How much more did John spend on the pens than on the pencils?

X - number of pencils $3

Y - number of pens $9

3X + 9Y = 108 => X + 3Y = 36 (1)

X/Y = 3/2 => 2X = 3Y (2)

Substitute 3Y in (1):

X + 2X = 36

X = 12 pencils

12*3 = $36 he spent on the pencils

108 - 36 = $72 he spent on the pens