The codeine is soluble in water, the paracetamol/APAP/acetaminophen isn't soluble in water. When you add the tablets to water the codeine dissolves and can pass through the filter, whereas the APAP cannot pass through the filter and is left behind as a solid white mass. While APAP is a painkiller it's not an opiate/oid. It inhibits prostaglandin synthesis (COX 1 and 2) rather than binding to various opiate receptors like codeine does, so APAP won't get you high in the slightest. The solution that makes it into the cup is where the codeine is.
Does that make sense?