Some sysctls must be in /boot/loader.conf and others must be in /etc/sysctl.conf. Which ones go where is not well documented. It seems to be something you have to determine empirically.
If you can do it via the command line with sysctl, then it goes in /etc/sysctl.conf. If the systems says “read only” when you try that, then put it in /boot/loader.conf.
Putting the sysctl setting in the wrong place generally leads to it being ignored.
All settings have the following format:
variable="value"