Where might these crimes be prosecuted?

Maryland has a “harassment” law (Title 3-801-806) which makes it a criminal offense to harass someone via email (among other ways). Person A resides in Maryland, Person B resides in Pennsylvania. Person B is sending Person A emails which meet the definition of criminal harassment under Maryland’s law. Could Person B be prosecuted under Maryland’s law? (Not “would”, not “should”, but could they be?)

Second example - Person C is standing in Bristol, VA and shoots (and kills) Person D who was standing in Bristol, TN. Would that be a federal crime? A state crime? Which state?

Disclaimers - you aren’t lawyers and I’m not asking for legal advice.

Murder is punishable under both federal and state law, but the fact that it crossed state lines doesn’t mean it’s punishable as a federal crime. Murders are only federal crimes when committed in wholly federal jurisdictions.

This is a fairly common misconception (that federal courts have to handle anything which involves more than one state). Federal courts have strictly limited jurisdiction, while state courts have broad jurisdiction. Essentially, the only time you end up in federal (criminal) court is when the offense is strictly a federal one (say, wire fraud) or the location is strictly federal (DC, Puerto Rico, outside the country, a military base, etc.)

As a general matter, a homicide occurs where the dead body is. If you shoot someone in the gut and drive them across state lines before they die, you’re a murderer in the receiving state - but also a batterer in the sending state. The important thing to remember here is that state courts may exercise concurrent jurisdiction - and in your hypothetical, that means both states could charge and/or convict Person B on the basis of the same act.

Other than double jeopardy, I can’t think of any reason why either state couldn’t prosecute. Every state has adopted some form of “long arm” statute allowing its courts to hear crimes or civil matters where the perpetrator is remote but causes harm in the state.

And to answer your first question: Probably yes. Person B, even though a resident of PA, purposefully directed an email into the state of Maryland subjecting him to personal jurisdiction there, much the same as if he sent a package of anthrax into Maryland.

You can avoid Maryland laws by not travelling to Maryland or causing something to enter Maryland.