Contemporary logic circuits use MOSFETs as the elements to build gates, but there are many ways to implement them. Using relays is one of them, and you can literally see how they work.
A collection of transistors and resistors that implement Boolean logic operations in a digital circuit. Logic gates have one or two 0 or 1 inputs but only one 0 or 1 output as in the following ...
Eerily, 62 years ago, these authors predicted that 10 7 inverter equivalent circuits ... have “canned” logic gates for a given process invoked by higher-level circuit languages).