Use limits.kernel.nice=-20
Tested working:
lxc launch images:ubuntu/focal c1
lxc exec c1 -- nice -n -20 whoami
nice: cannot set niceness: Permission denied
root
lxc stop c1
lxc config set c1 limits.kernel.nice=-20
lxc start c1
lxc exec c1 -- nice -n -20 whoami
root