This is not the best worded problem I have ever heard, but, I think I understand, maybe;
since they got 65 mpg together, car A gets y mpg and car B gets 65 - y mpg. We can assign the gals used to either to determine the value of "y" , so
65-y X 30 + y X 40 = 2200
1950 - 30y + 40y = 2200
10y = 250
y = 25
65 - 25 = 40
so one car gets 25 mpg aver. and the other gets 40 mpg aver. which gives us the totaled average of 65
to check to see if these numbers will work : go back to original equation
65-y X 30 + y X 40 = 2200
65 - 25 X 30 = 40 X 30 = 1200
25 X 40 = 1000
1000 + 1200 = 2200