Undergraduate research teaches you a lot of things, and some of the things can be exactly what you are thinking of. Most of them aren't, though. However, you'll be surprised at how much an intelligent, well-guided, and encouraged undergraduate can do.
So I started doing research in the second month of my undergraduate career. I'd been a programmer for a long time before college, so I was able to use that as grounds for my advisor to hire me. As a student, something that gets to be really important when starting to do research is that you understand the situation you will be in. It's going to look hopeless (as a freshman, it was an incredible level of hopelessness), you're going to feel like you couldn't possibly learn, know, and understand everything that's going on in the field, and you won't know if anything will even come out of the work you're doing. It's easier not to worry about this as an undergraduate, and to only focus on how well you can learn to learn.
Something important that I learned when working in numerical astrophysics is how to take a computer, figure out how to tell it things, and make it do math to simulate a physical system. This is something that, if you've had no prior exposure to, is very difficult to imagine. In the beginning months of my research, I spent all of my days thinking about how these problems could be solved, what is lurking in the depths of these massive codes, what higher level mathematics is being used that I have no semblance of right now. It was certainly something that, to a curious, research-oriented mind like my own, required long periods of deep thought as well as hours and hours of sitting on a computer reading the 30 tabs of Wikipedia articles I had opened. I was lucky to have an advisor that was extremely patient with my ignorance of even the basic mathematics needed for research. For example, my first mini-project was to find the gradient of a gravitational potential for a dark matter halo, and then to implement by writing some code to calculate the force on a particle in that field. It was a bit weird to me at first considering I had just enrolled in integral calculus for that semester, but luckily I was able to learn. The math method itself wasn't difficult to learn, but if you're like me you'll be dying to understand how everything works, and you'll despise using things with only a superficial understanding. However, at some point you will realize that you must take things as they are, because you aren't ready to understand it quite yet.
When I moved on to work in a condensed matter group, a year later, I had a much deeper understanding of the physics I was studying. I was (and am) able to try and start working on my own implementations for solving physical problems (and understand and implement numerical algorithms developed by others to my specific problem). After a year of being in the research state-of-mind, I feel that my knowledge and understanding of physics and the related mathematics is much better than I could ever have gotten from sitting at home and doing all my homework properly. There is the added bonus that you become more and more effective at research, as long as you're given some meaningful work to do (of course, I do my fair share of running simulations and writing data analysis scripts, but I'm also heavily involved in developing new approaches to solving the main problems we need to solve). I learn much better when I'm given a problem that I have no idea how to solve, because I'll go find all of the information I need, read and learn it, and then solve the problem. In this way, anything and everything is relevant because it may hold the key to solving my particular problem, so I feel that I learn more material more effectively, with a deeper understanding. There is a slight motivation factor when you consider that your research project could have big outcomes, something that a homework or even a test will never do for you.
I know we are talking about the merits of this research, but I feel compelled to mention that there are other reasons you should do undergraduate research as well. If you are wanting to get a graduate degree, it takes a lot of stress off your first years when you know what to expect. As a graduate student (not from personal experience, only second hand), you won't immediately begin your thesis project. It might be random walk-ish in terms of projects that you work on before you get to a point where you can choose a good thesis topic. Learning to deal with failure in research is a huge part in progressing without going insane, and if you've dealt with this while having some personal guidance from a professor, it will be much easier to be independent in graduate school. It takes a lot to get a Ph.D, and having an understanding of what it will be like before you tackle it may mean the difference between you dropping out after you finish up your master's courses or plowing through to the dissertation defense.
The other thing to mention is that these research problems don't have any time limits; you're not meant to finish it in a two hour class period. Actually, the correct thing to say is that it wasn't designed to be done in two hours (because, of course, it wasn't designed, and that is why it's so exciting!). These problems, as I mentioned before, were at the center of my mind most of the time. It was on my mind while I was walking, eating, driving, sitting in class, showering, etc. This is the typical way you think of research problems I think, and it's good to get used to this. It may sound dreadful to some, but it isn't something that you must force yourself to do; you will feel the compulsion to solve the problem on your own, and your brain will constantly be working towards it.
Some people thrive on this sort of thing, and it'll push them to learn at an incredible pace, one that is unmatched by any classroom learning. This is the largest benefit, to me, of doing research as an undergraduate. Whether you have the mind/personality for research or not will become clear to you as soon as you start doing it. If it's not for you, you're better off knowing now. If you do have it in you, you've built a very good intellectual and psychological foundation for your future career as a researcher.
[Just for transparency/honesty, I'm finishing up my second year as an undergraduate, so don't hold me to my word on graduate life experiences or teaching methodologies, they're only what I've read or heard (or, in the latter case, my opinion).]