Coal doesn't even compete with just solar, those aren't your two options.
Coal competes with literally everything else, and it loses to every single one of them. It's a terrible, terrible fuel. Burn natgas instead and you're already magnitudes better off.
Coal only exists today in the US because our politics is broken beyond belief.