Their is no penalty for overpaying your taxes unless you mean the implicit loss of the time value of the money overpaid.
Anyone who's been "penalized" for overpaying their taxes was actually underpaying their taxes prior to their overpayment. People don't realize that taxes are generally due over the course of the year (usually quarterly), not all at once on April 15/16/17. The April deadline is just the due date for the final payment of your prior year's tax liability. If you were underpaying during the year, you could be penalized for that even if you overpaid in April the following year.
This is why trying to game your withholding on your wages (i.e., minimal or underwithholding) is such a bad idea. Any gain (i.e., investing in stocks) is usually more than offset by the penalties and interest you pay if you end up being wrong about how much in taxes you owed. The stock market would have to have a very bullish year to see an upside, usually better than 10% growth--and the target just goes up as interest rates go up.