Classification algorithm that only matches trained examples
Strictly speaking Machine Learning is not the answer to this problem imho, because a ML method always works by generalizing what is in the data. In other words ML methods are meant to make some guesses while statistically minimizing the risk of error: if you don't want any generalization or risk of error, you don't want ML.
There might be some symbolic methods which could do what you describe, but essentially it's just a very simple deterministic method:

Obtain the frequency for each distinct instance (including label) in the training data in a map
For each distinct instance (only features) keep the most frequent one and discard all the others.
When applying, just look up the instance in the map and assign the corresponding label.


a cumbersome db infrastructure with columns, keys, indexes and other boring things.

There's a confusion here: the question of using a database or not is irrelevant here since it's a matter of how you store the data, it's just not related to using ML or not.
Usual advice: use the right tool for the right job... even if it's boring ;)