It's not about speed or weight.

It's about heart rate and duration.

If you're getting your heart rate up into the range where you're getting a cardiac benefit (and I'm not going to give you a number because it's an individual thing based on age and level of training), AND you're riding for the same amount of time up in that effective range, then you're getting "enough" of a workout.

However, if you're cutting out early (timewise, distance can go poo for these purposes) or dropping below the effective range for heart rate, then you're NOT getting as good a workout.

Generally you're looking at something like 70% to 80% of your max heart rate (based on age and condition). How long you stay up there to get an effective workout varies, but if you're staying up there as long or longer on the heavier bike then you're set.

The heavier bike likely will get you into your training range quicker than your lighter bike (which may shorten your total amount of time spent on the bike), but how long do you STAY there? That's what matters, not how much the bike weighs.