What these do is let you do things like turn a collection of objects into a the HTML for a table and send that over the wire. The client then just has time to display the table and not assemble it from e.g. JSON. ERB and similar allow you to build dynamic sites without using any Javascript at all.
To a first-order approximation, any dynamic site that does not use React or Angular will use a templating language like ERB.