The $q$-Racah polynomials from scalar products of Bethe states II
The theory of Leonard triples is applied to the derivation of normalized scalar products of on-shell and off-shell Bethe states generated from a Leonard pair. The scalar products take the form of linear combinations of $q$-Racah polynomials with coefficients depending on the off-shell parameters. Upon specializations, explicit solutions for the corresponding Belliard-Slavnov linear systems are obtained. It implies the existence of a determinant formula in terms of inhomogeneous Bethe roots for the $q$-Racah polynomials. Also, a set of relations that determines solutions (Bethe roots) of the corresponding Bethe equations of inhomogeneous type in terms of solutions of Bethe equations of homogenous type is obtained.