Theoretical electron transfer cross sections for 1.3-130 eV/amu singly charged ions colliding with Rydberg atoms (n = 28, m = 2) in a magnetic field up to 4 T are presented. Both paramagnetic and diamagnetic interactions are taken into account for the initial state and the collision. Cross sections are calculated within the classical trajectory Monte Carlo model. A method to create a classical ensemble of electrons in a nonseparable Hamiltonian allows the initial quantum stationary states to be modeled. The effect of the magnetic field on electron capture is analyzed in terms of the field-induced alteration of the initial state as well as the direct influence on the collision dynamics.