(c) That's right. If a contract states that a specified sum of money will be payable as a penalty for a breach of contract, the courts will not enforce payment of that agreed sum. The courts will not enforce penalty clauses in contracts.
But penalties must be distinguished from what are called 'liquidated damages'. Sometimes, at the time of contracting, the parties estimate what losses will be suffered if a particular breach of contract should occur. They insert a clause in their contract saying this amount will be payable if the breach actually occurs. As long as these 'liquidated damages' are a genuine pre-estimate of the likely losses, the courts will enforce payment, even if the losses actually suffered are more or less less than the agreed amount. In the present case, the $5,000 is clearly a penalty and will not be enforced against A.
The courts have also said that a sum payable is only a penalty if it is out of all proportion to the likely damage, or is extravagant, exorbitant or unconscionable.