I think with older versions of Apache, the RewriteEngine on directive acted as kind of a reset of the rules. The thing to remember is that {HTTP_HOST} never contains anything but the domain/subdomain. So for your second rule, where you are trying to test the requested path, that will never be contained in the host line. A request for a page on your site looks like the following:
GET /somefolder/somepage.html
Host:
www.somedomain.com
To test what folder the user is requesting, you need to use the value on the GET (or if form data is being submitted, POST) line, which is in the {REQUEST_URI} variable for mod_rewrite. You also are not testing if the user is already in the /f/ folder, which is why the user gets stuck in an endless loop.