1) The Germans weren't using Panthers when the M4 first came out. In fact, the US was a little surprised to find out the Germans already had so many after the Normandy invasion (the Germans used them in the East against the Soviets first).
Panzer IV sorry!
2) The M4 was better than the M2 or the M3 - and the M3 was very much a rush job. What was the alternative? Not fight German tanks until the US had a tank to match them?
Create a HAT weapon that was more reliable and harder hitting than the M1a1. A tank with more armor and a larger gun (essentially the Pershing) without sacrificing a great deal of mobility would have been ideal. Something like a mixture between the Sherman and the Tiger II
3) The Panthers weren't so invincible themselves. They were great on an open battlefield - if they made it to the battlefield without breaking down. They were a rush job, themselves, and very unreliable. During their early days, the Germans lost more Panthers to mechanical breakdowns than they did to enemy fire. They were also vulnerable to attacks on their flanks, especially at close range fighting in obstructed terrain (city fighting, for example).
Hard to argue with this, but at the end of the day I would rather be on the inside of a German tank.
Before saying something was a design failure, you have to look at what it replaced and how much pressure there was to replace the old as quick as possible. War is especially notorious for creating so much pressure both sides wind up taking the attitude that "perfect is the enemy of good".
Always is easier to say we shouldn't have done that after the fact. At the time I suppose it made a good deal of sense to be able to produce something quickly and efficiently.