JWST/NIRSpec Measurements of the Relationships between Nebular Emission-line Ratios and Stellar Mass at z ∼ 3–6