How to configure a relay to operate as a transistor?
You are looking for the standard function of a relay.  People are complaining about the transistor analogy because your transistor is already configured to act as a relay :)

Here is an example of a standard connection. SW1 might be a switch, a button, coming from some other transistor, from a PLC, etc...



If you want to hook your 12V power supply up to the "collector", change the circuit so that it looks like this:



Usually this would be done because you want to switch more current than SW1 could handle.

By the way, when referring to relays the standard pin names are:


A1: One side of the coil
A2: The other side of the coil.  Often connected to ground.
COM: The pin that you are calling the "collector"
NC: "Normally Closed" - The pin that is connected to COM when the relay coil is not energized
NO: "Normally Open" - The pin that is connected to COM when the relay coil is energized


Like this: