Actually, nobody even went as far as saying "latinum can't be replicated".
For all we know, it can, just like hundred-dollar bills can be printed. But money is money: it has value because people agree that it does. Today, worthless pieces of paper have value because we agree that they do. The agreement would be thrown into confusion if everybody replicated these pieces of paper, so we insert codes into the as such worthless material to prevent this. The Ferengi probably insert codes into their as such worthless latinum, too. And replicating a code doesn't add to your possessions, because codes are unique and supposedly will be checked against a database. A hundred bills (or latinum bricks) with identical codes are only worth one
bill (or brick), plus a few years in jail...
Today, we don't check even bills worth a thousand dollars against a code database as a matter of routine, because that's way too difficult to do; we trust that the other anti-copying measures work. But in Trek, checking against a database would be trivially easy.
Of course, not all coding need be database-reliant. Quark has been known to check the value of the small latinum strips by biting. Perhaps programming an authentic taste into the strips takes a lot of replicator resources (many people complain that replicator food doesn't taste as good as "real" food), and only an idiot would thus replicate a strip of latinum when it costs 153 strips to get the taste right.
The bigger units such as slips and bricks could of course retain the taste coding, but would also have more complicated things in them, just like bills are more complexly coded than coins today. The idea is never to outright prevent copying - it is merely to make copying more expensive than the acquisition of the real deal.