It's mainly a class thing, middle and upper-class blacks will usually speak in "normal" accents, poorer or less-educated blacks speak a somewhat dialectical form of English ("Ebonics") with slightly different grammar and vocabulary and spoken with a somewhat singsongy accent.
First, I think it is a bit unfair to say all blacks, or all whites.
Some if it has to do migration patterns. Most black people or their families moved from the South between 1920 and 1965. When they did, they brought a southern dialect with them and tended to concentrate in specific geographic areas (not necessarily by choice). It got reenforced, but slightly changed by contact with people living here, and by black people with
slightly different Southern accents.
Three examples:
1. One of the people that I know with either the thickest or second thickest Philadelphia accent, which is a "white" accent, is black. Her family lived here for a while.
2. At the welfare office, I handled a client for my coworker, Eleanor, who was away from her desk. When she came back, Eleanor asked me if the client was black or white, based on the telephone conversation. I said black, and then she showed me a photo a woman with blue eyes, red hair and skin for shades lighter than mine.
Eleanor, who was black, laughed and said, "The first time I talked to her, I thought she was black. She was talking about going down to North Carolina to visit her family. I was sure she was black."
3. The person who I know who has one of the thickest black accents if heard, has a doctorate from Penn, lived in a rather tony suburb, was president of a state professional organization, and drove a Volvo. She grew up in Virginia.