tl;dr- the joke here is that a Southerner would think Maryland is "the North", and a Northerner would think Maryland is "the South".
"Yankee" is/was a derogatory term for Northerners, most typically used by Southerners during the Civil War and Reconstruction eras. If you want to get technical, it applies most strongly to New Englanders, but when used by a Southerner, it's a pretty broad brush. Nowadays, you'd be hard pressed to actually find someone using the term "yankee" in any sort of serious or angry way. It's much more common to hear it in a tongue-in-cheek way, which is how the parent commenter was using it.
"Damn Yankee" is something of a stereotypical phrase you might hear from that time period, especially Reconstruction, when there were still a lot of hard feelings about the war, as well as about Northerners who moved south to participate in Reconstruction, often known as "carpetbaggers" and who were thought of as profiteering from the situation.
But nowadays it's more of a cultural joke, or meme. Like for example, if someone were to recommend me a barbecue restaurant in, like, Vermont or something, I might say "I don't know if I trust a damn Yankee to make good barbecue!" (To be fair, I would have very low expectations all the same. Barbecue just isn't the same outside the South.)
As for "redneck": it's still something of a disparaging term, and connotes poverty, poor education, and general backwardness. It's sorta like the word "hillbilly" or "country bumpkin", except with a more distinctly Southern vibe. However, it's been partially reclaimed and is often used by country folks to refer to themselves.
However, it's not exactly a term used only by Northerners- it wouldn't be at all surprising to hear (for instance) a Southern doctor or lawyer grumbling about "a bunch of stupid rednecks" causing trouble.