Well you've kinda answered your own question: Both videos have the same size because you used the same settings, specifically the settings for target bitrate and maximum bitrate (assuming you're using the H264 codec, other codecs might only have an average bitrate setting available). If you use identical bitrate settings, videos of the same length will always have the same size, regardless of it's resolution and framerate. This is because the bitrate is exactly that: The (average) amount of bits per second. If you have a 10 second video with a bitrate of 10 Mbit/s, it's size will be about 100 Mbit, simple math.
To elaborate on how this is possible with videos with different resolutions: Most commonly used video codecs (as well as image formats) use highly efficient compressing algorithms that can use different levels of compression, where a higher compression level yields smaller video files at the cost of some video quality loss. For example, a JPG image will combine nearly monochrome chunks of the image to one block of information. The higher the compression, the higher the tolerance for similar pixels, resulting in compression artifacts:
So what does that mean for your video? To accommodate for the higher resolution of your 4k video, you will need to use a higher bitrate in order to yield better quality, as there is much more information in a 4k video. If you use the same bitrate, the 4k video might actually look worse because there are more compression artifacts.