A copolymer poly(ethylene glycol)-polyallyl mercaptan (PEG-PAM) material is used as a drug-containing coating for medical implants. In one embodiment, a mixture of multi-arm poly(ethylene glycol) (PEG), polyallyl mercaptan (PAM), a photoinitiator, organic solvent, and one or more drugs, medicaments, or pharmaceutical compounds is applied to a surface of the implant and is exposed to a polymerizing light source to form a PEG-PAM material coating that is formed in situ on the implant. The PEG-PAM coating may be used by surgeons to incorporate antibacterial drugs or the like into coatings that are applied in the operating room setting to medical devices such as orthopedic implants. The type of drug and dosing can be customized during the coating operation and tailored to the patient's needs. PEG-PAM may also be applied as a coating on or within tissue or an injectable gel.