Along the ramp requires less force over a greater distance, whereas lifting it straight up requires more force over a short distance. In both cases the same amount of work is done. Another way of saying this is that it takes the same amount of energy in both cases. (Work has units of energy.)
work along ramp = work lifting straight up
dF = dF
This discussion considers only the work done against gravity if lifting the object. Other forces, primarily friction, can alter this. That is, ther can be some differences in the work (energy) needed to move the object to the top using the two methods.