Kmart Corp. has agreed to pay $32.3 million to settle a whistleblower lawsuit alleging its pharmacies overcharged federal health care programs and some private insurers for generic prescription drugs, federal officials announced Friday.