I saw it on a prep book and there says the meaning is to waste time and money, but I don't understand how.
馬鹿を見る is a common idiom, but different sources provide different definitions to it...
I feel these definitions are not wrong, but insufficient. The basic meaning of this idiom is "to be insufficiently rewarded (for one's effort/honesty)", "to feel unappreciated", "to feel like a fool because something ended up with nothing", etc. Depending on the context, "to be left holding the bag" or "to draw the short straw" might be a valid translation, too. 正直者が馬鹿を見る is a common proverb meaning "Honesty doesn't pay."
自分 is "oneself" and can refer to anyone (I, you, he, etc) depending on the context. だけ is "only/just". Therefore 自分だけ馬鹿を見る means something along the lines of "Only myself/yourself/etc will be unrewarded/unappreciated".