How is it technically possible for PostgreSQL to keep small tables "in RAM"?
This is possible due to Write-Ahead Logging (WAL):

Briefly, WAL's central concept is that changes to data files (where
tables and indexes reside) must be written only after those changes
have been logged, that is, after log records describing the changes
have been flushed to permanent storage. If we follow this procedure,
we do not need to flush data pages to disk on every transaction
commit, because we know that in the event of a crash we will be able
to recover the database using the log: any changes that have not been
applied to the data pages can be redone from the log records.

It's a central component of Postgres' architecture and turned on by default. You can configure a couple of parameters like instructed in the manual chapter WAL Configuration.
Also consider basics on Reliability in the manual.