5. B.

Let the ages of Jones's four cousins be $a$, $b$, $c$, and $d \left(a, b, c, d \in \mathbf{Z}_{+}, 1 \leqslant a, b, c, d \leqslant 9\right)$.
From the problem, we know
$$
\begin{array}{l}
a b=24, c d=30 \\
\Rightarrow(a, b)=(3,8) \text { or }(4,6), \\
(c, d)=(5,6) .
\end{array}
$$

Since the ages of the four people are all different, we have
$$
a=3, b=8, c=5, d=6 \text {. }
$$

Therefore, $a+b+c+d=22$.
5. The ages of Jones's four cousins are four different positive single-digit integers. The product of the ages of two of them is 24, and the product of the ages of the other two is 30. Then the sum of the ages of the four people is ( ).
(A) 21
(B) 22
(C) 23
(D) 24
(E) 25