The kinetic-energy difference ΔT=T-Ts[ρ0] is calculated for the helium isoelectronic series and for the beryllium atom. Ts[ρ0] is in this case the kinetic energy corresponding to a noninteracting N-particle system which, however, has the same density ρ0 as the exact interacting system. These densities ρ0 were assumed in the present case to be well represented by those coming from the optimal Hylleraas-type expansions for the He isoelectronic series and by the Bunge-Esquivel 650-term configuration- interaction wave function for Be. The calculations are carried out by means of a constrained variational method based on local-scaling transformations. The connection between this approach and the one based on the Kohn-Sham equations is discussed.