Both of these expressions contain the word” hope.” This is a word that English orators often add to statements demonstrating they want or believe something to be true. Hopefully is an adverb, which means it modifies the verb. It means to be something your not necessarily expecting, but you are believing that it should happen. It could also be a display of hope.
For example, “the dog stared hopefully at the window, waiting for its owners to return.” I hope so, on the other hand, could mean expressing a measure of hope. It could also expect a response to a question that maybe there is hope.
For example, “Do you think he wants to come home?” Someone answers, “I hope so.” In this instance, hope is a verb because it is something that you are doing, “hoping.”