Notice that if we were to have the ratio:
The units would simplify to gallons per dollar.
Now notice that if you have:
That ratio is just a differential amount of paint over a differential amount of dollars. The units have not changed, they are still gallons per dollar, except this ratio shows how g changes when p changes.