Lanefan said:
Then don't cast near where your friends are!

And don't delay either, just cast where your friends aren't...hit the enemy backliners and let the fighters deal with the frontline.
I found that never really came up. Most of the time it was things like:
DM: "You are traveling down a 15 foot wide hallway. The Paladin, Fighter, and Rogue walking three a breast in the front row, the Wizard and the Cleric behind them. You see 3 Hobgoblins up ahead, they run up to the party into melee with all three of your front line friends."
Me: "Umm, I fireball, since that's perfect, I put it just far enough back that the 20 foot radius hits all of my the enemies and ends right before it hits my friends"
DM: "Alright, make a roll to see if you can aim well enough."
Me: "Ok, what do I add to it and what is my chance of succeeding?"
DM: "Just roll a d20, you don't know exactly what your chance of succeeding is, I'll figure it out based on what you roll."
Me: "Umm...ok, well, according to the rules it succeeds automatically."
DM: "Yeah, don't quote me the rules, the DM is always right, and I don't care what any rules say, you can't just place spells within a couple of inches of accuracy."
Me: "Well, I don't want to hit my friends...."
DM: "Just roll already."
Me: "Ok...15."
DM: "Alright, roll your damage."
Me: "Cool, I missed them, whew, I was really worried there for a minute. Well, 36 damage."
DM: "Fighter, Rogue, Paladin, you all take 36 damage. You don't get Reflex saves since you weren't expecting an attack from BEHIND you."
Me: "What? 15 didn't make it? What did I need to roll then?"
DM: "I don't know what you needed to roll, but 15 doesn't sound high enough to me to have pinpoint accuracy like you are CLAIMING you should be able to do. I mean, it requires adjusting it within 6 inches or so to hit one but not the other. I don't know, maybe a 20 would do it."
There were also enough times where we'd be fighting 1 ogre as a combat, or 1 troll or 1 minotaur...and 2 or 3 melee types would be beside the enemy. If there is a chance of hitting your allies in melee with any spell that takes an attack roll or any area of effect spell, then it narrows your options to delay, use a magic missile, or use a nondamaging spell that targeted One Creature, since most DMs didn't assume those had a chance of hitting one of your friends.
Lanefan said:
Hard to know if that's bad tactics or bad rolling; being a video game you don't see either the to-hit rolls or the random-direction-of-miss rolls, so there's no way of knowing if it's set up to have you always clobber your friends or not.
Well the reason it always happened in those video games was that it worked in real time. You'd say "Cast fireball at that enemy there". You allies would all run up to attack that enemy, since you would only fight 1 or 2 monsters at a time and it was their only option. It would display the casting animation for a second or two, just long enough for the rest of your party to close the distance to the enemy and BLAM, they were hit.
The only way to avoid it was to remove friendly damage or micromanage your party, giving them all ranged weapons so they didn't get into melee right away or telling them all not to attack unless you specifically said so.