RAW files on a 50D have 14 bits of data per channel. JPGs, on the other hand, only have 8 bits of data per channel. What does this mean? Well, in a JPG file, values for red, green, and blue range from 0 to 255. In a RAW, red, green, and blue range from 0 to 16383 (effectively). That means there's 64 times more data in the RAW file.
But you can't really display all of that, so why would you want it?
Well, let's suppose you accidentally overexpose an image so that all of the data is in the right half of the histogram. With a JPG, that would mean red, green, and blue only had 128 possible values (values from 128 - 255 (the left hand-side of the histogram, 0-127 is empty)).
If you edited the image, spreading the data out so that the entire histogram was filled, there would still only be 128 unique values for each channel (here, I'm ignoring interpolation which would cause the image to soften; I'm also ignoring dithering, which would help, but effectively introduce noise). So even though you'd now have an image with solid blacks and bright whites, gradations would be blocky.
Looked at numerically:Initially, your gradation contained: 128, 129, 130, ... 255
After corrections, the gradation contained: 0, 2, 4, 6, 8, ...254
You're jumping by twos in the corrected image because you're trying to cover 256 values with 128 unique inputs.
If, however, you did the same thing with a RAW file, you'd have started with 8192 possible values for red, green, and blue (8192-16383). Looking at that numerically:Initially, the gradation contained: 8192, 8193, 8194, 8195, ... 16383
After adjustments: 0, 2, 4, 6, 8, ... 16382
But, you're still counting by 2's, right? How is this better?
Well, you still have way colors than are displayable by most devices you're likely to use (your monitor probably is 8 bit, or possibly 10 bit; either way, it has fewer colors than the 14 bit RAW file). When you scale your data back down to fit into the 0 to 255 range used by your display, printer, etc, you get:0 / 64, 2 / 64, 4 / 64,...
0, 0.03, 0.06, ..., 16384/64
0, 0, 0, ..., 255
Thus, all numbers from 0 to 255 are represented (without averaging any of the existing data) and you get smooth gradations.
That means RAW allows you to more heavily edit images without causing visual artifacts.
Note that the above works no matter how you've over or under exposed your image -- up to a point, of course