It's called diglossia. It's a much more common phenomenon in Europe where dialects are more developed. Most people can speak both the dialect they were raised with and the official standard language. They can switch back and forth, and often used the dialect at home and the standard form when speaking to people they don't know. The problem with Europe is that often these dialects are so far apart, they aren't mutually intelligible, so you have to know the standard.
Ebonics is still close enough to standard English that we can all understand Snoop Dogg, no matter how high he is. Of course, there's also the stigma that the standard English is somehow more "white."
On a related note, my mum's family is from Liverpool and they all speak with a posh, upper-class British accents at home. I can speak the same way just as well as they can, but can also speak with the same ol' accent everyone around her speaks with. Of course, I only really do the British thing when I'm joking around, and occasionaly speak with a Bitish-Canadian mixture when I'm talking to my Grandad and Nan, but still.