I don't really think it is funny. I'm not usually the one making jokes. I have to say, I'm not interested in touching a black guy's dick. I'm also just not into seeing black guys in porn. It is a big genre in porn though. I think because at one time, black men doing white women was such a taboo. This is where the humor in the joke comes from. It is slightly unsettling. It borders on two forbidden topics: 1)"Flipping another man's meat" as the Heineken light commercial says, that is, talking about another man's junk, and 2) the mystique of interracial love.
Yes, sometimes when white men joke about the size of a black man's dick, it is a kind of indirect boast. Like, "I must be part black." Or "I'm black from the waist down". Things like that. Friends may also talk up a friend of theirs, just to boost his confidence, to him, or to talk him up to a potential female partner, with jokes like I have mentioned above - whether or not the guy in question actually has a big dick. They may also make these kind of jokes for seemingly no reason, in cases where the guy in question actually does have a pretty big dick, and this is known among the friends. Some bigger guys are proud, and will talk, or show off. Friends of bigger guys, often feel the need to joke about this. Firstly because they are a little uncomfortable, and this is the source of a great deal of what constitutes humor. Secondly, again because it is a form of indirect boast. If you point out a bigger guy as having a dick that is large enough to be noteworthy, it is hardly ever taken as a slight to him. It usually means that the guy making the joke means to point up, subtly, that while his friend is "huge" or "hung like Mandingo" or whatever, he himself is of a pretty respectable size, even if it falls more within the typical range.
Yes, I think there is a lot of large penis envy. Especially among younger guys. Some men, large and small, never give the size of their dicks a thought, but for many others penis size is a big concern. I think many men are confident about their penis, except if they happen to see somebody who is much bigger. It seems like seeing black guys who are a least much bigger flaccid is a common disconcerting experience for white men. It makes them a little nervous, but making jokes about it, diffuses this tension in some ways.
And finally yes, the larger a guy's penis is, the more likely he is to joke about it. Not every white man though thinks that black guys are bigger, and some vehemently dispute the notion, from a sense of scientific correctness, from a need to combat bias or stereotyped notion, as well as from a possible sense of inadequacy, or again as a form of indirect boast.