I apologize for this question which might be trivial but I'm stuck with this issue and I'm probably doing some mistake over and over again. Here's the framework. Let $f$ and $h$ be two multiplicative functions and, for a fixed positive integer $m$, consider the sum $$ S_m = \sum_{n\geq 1}f(n)\prod_{p\mid \gcd(m,n)} h(p)\;. $$ Since $\gcd(m,n)$ is multiplicative as a function of $n$, I define $g_m(n)=\prod_{p\mid \gcd(m,n)} h(p)$ when $\gcd(m,n)>1$ and $g_m(n)=1$ otherwise, so we have $$ S_m = \sum_{n\geq 1}f(n)g_m(n)\;. $$ But $f(n)g(n)$ is again multiplicative, so we can perform Euler product expansion. In particular, I'm interested in functions of the type $$ f(n)=\frac{\mu(n)}{f'(n)}\;, $$ with $f'(n)$ again multiplicative and $\mu(n)$ being the Moebius function. This simplifies Euler product because $$ \sum_{k\geq 0} f(p^k) = 1+f(p)\;. $$ Then, $$ S_m =\prod_p [1+f(p)g_m(p)] = \prod_{p\nmid m}[1+f(p)]\prod_{p\mid m}[1+f(p)g_m(p)] =S \prod_{p\mid m} \frac{1+f(p)g_m(p)}{1+f(p)}\;, $$ that is $$ S_m = C_m S\;, $$ where $$ S:=\prod_p [1+f(p)]=\sum_{n\geq 1}f(n)\;. $$
Now consider the simple following example with $m=2$: on one hand we have $$ S_2=\sum_{n\geq 1}f(n)g_2(n) = \sum_{\substack{n\geq 1 \\2\nmid n}} f(n) + h(2)\sum_{\substack{n\geq 1 \\2\mid n}} f(n)\;. $$ If my computations are correct, I can't understand how the latter expression could become a multiple of $S$? Where's my mistake?
Thanks in advance and happy new year!