In this paper (arXiv:2304.08843), by using the theory of Lie-Hamilton systems, formal generalized stochastic Hamiltonian systems that enlarge a recently proposed stochastic SIS epidemic model with a variable infection rate are considered. It is shown that, independently on the particular interpretation of the time-dependent coefficients, these systems generally admit an exact solution, up to the case of the maximal extension within the classification of Lie-Hamilton systems, for which a superposition rule is constructed. The method provides the algebraic frame to which any SIS epidemic model that preserves the above mentioned properties is subjected. In particular, we obtain exact solutions for generalized SIS Hamitonian models based on the book and oscillator algebras, denoted respectively by 𝔟2 and 𝔥4. The last generalization corresponds to a SIS system possessing the so-called two-photon algebra symmetry 𝔥6, according to the embedding chain 𝔟2⊂𝔥4⊂𝔥6, for which an exact solution cannot generally be found, but a nonlinear superposition rule is explicitly given.