Our study aimed to investigate the association between RFM and kidney stones, focusing specifically on the mediating role of high-density lipoprotein cholesterol (HDL-C). We performed a cross-sectional analysis using data from the National Health and Nutrition Examination Survey (NHANES) covering the years 2007 to 2018. Our analytical approach included multivariate logistic regression modeling, subgroup analysis, generalized additive modeling (GAM), smoothed curve fitting, and receiver operating characteristic (ROC) curve, as well as mediation analysis to assess the association between RFM and kidney stones. Finally, we categorized RFM into normal and elevated groups to conduct a sensitivity analysis. This study involved 29,712 participants, with a kidney stone prevalence of 9.88%. We discovered a positive association between RFM and kidney stones (OR = 1.41 per SD increment, 95% CI: 1.24, 1.60). Subgroup analysis revealed a consistent positive association across all subgroups, with a notably higher likelihood of developing kidney stones in young adulthood (P for interaction < 0.05). The smooth curve fitting shows that RFM is nonlinearly and positively correlated with the prevalence of kidney stones. Additionally, HDL-C was found to be negatively associated with kidney stones. Importantly, HDL-C demonstrated a significant mediating effect, with a mediation ratio of 13.52%. ROC analysis indicated that RFM (AUC = 0.616) provided better diagnostic accuracy than traditional measures such as BMI (AUC = 0.565) and WC (AUC = 0.599). Furthermore, the sensitivity analysis further supports the robustness of our findings. RFM is nonlinearly and positively correlated with the prevalence of kidney stones, with HDL cholesterol playing a significant mediating role in this relationship. However, further studies are needed to confirm these associations and explore potential mechanisms.