Benamou–Brenier and duality formulas for the entropic cost on RCD∗(K, N) spaces