I think so but you will have to compile everything locally.
A lot of packages will not have been tested toi run from there.
The instructions to do this are in the normal Installation document
The documentation also says
If you decide to use another prefix: don’t open any issues, even if you think they are unrelated to your prefix choice. They will be closed without response.
The instructions are
TL;DR: pick another prefix at your peril!
mkdir homebrew && curl -L
| tar xz
--strip-components 1 -C homebrew
or:
git clone homebrew
then:
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
My final comment is that macOS is not Linux so expect things to work differently and forcing Linux ways on macOS will cause you more trouble.