I do this often. My mk.conf has the following as one example.
PKG_DBDIR= /opt/pkg/var/db
LOCALBASE= /opt/pkg
VARBASE= /opt/pkg/var
Note that programs with many dependencies means you will have those many
dependencies installed twice.