I don’t have the ST:TNG tech manual handy, but IIRC, the transporter erects a temporary force field around the spot where a person or item is being transported to, does the transport, then takes down the field. Unlike the plastic door on a coffee vending machine, force fields don’t get scuffed up and dirty - they’re made fresh each time, so they’re invisible.
Replicators are nothing more than transporters working off recipe books, rather than quantum scanners.
Apparently they do need “raw foodstock” to make things from. Which is probably why they can’t make really exotic things - they don’t have all the rare ingredients. Spicy, zesty, or otherwise unusual foods probably can’t be duplicated. In fact, it apprently can’t even get the taste of ordinary food down perfect.
Seriously! Try it out next time you’re hungry. Order a French pastry in an East Indian accent. You’ll get cheese doodles 7 out of 10 times. Do it 100 times in a row and most consumer level replicators wil just pop out the base organic materials. Which, oddly enough look a lot like the coloured food cubes Kirk and gang used to eat. Weird but fun. Military/government units have filtered protocols which prevent this, unfortunately. It would be so fun to hide a camera in a Klingon envoy’s guest quarters and watch him mangle “Tea! Earl Grey! Hot!” out of curiousity and see him get chocolatte mousse (poisonous to almost all humanoids other than Homo Sapiens Sapiens).
“I was at a party, and was just replicating a drink when we passed through a tachyon storm, at which point all my clothes fell off and the inertial dampers failed and…well, that’s how the coke bottle got stuck there, anyway, honestly!”
I have a question about replicator etiquette. There was an episode where Crusher and Picard are in his office, and he requests a cup of Earl Grey tea, hot. I found it rude that he didn’t offer Crusher anything. I mean, it’s not like he had to go hunt down a targ or anything.