Depends on how you shoot, what you expect in a camera, and I would also say to some extent, where you live in the world.
You have Leica rangefinder experience, so you can check a used M240 in many ways similarly to a film camera to ensure it's operational, i.e. checking shutter speeds, rangefinder accuracy, but you get the results immediately on the camera without needing to shoot and process a roll of film. You'll want to do test shots at various aperture settings and check the results to see if there are any obvious sensor defects. It's typical to have black spots on images due to dust on the sensor. If using a blower bulb (or wet cleaning) doesn't dislodge the dust, or if there are signs of scratches on the sensor glass (straight, sharp-edged lines) that don't look like hair, you'll want to move on as it would require costly sensor replacement to eliminate (or a lot of retouching later).
In respect to the M240 vs. the M9... again it will depend on your expectations. The M240 is a considerable operational refinement over the M9 with many fewer 'digital quirks' that can pop up during use. For example with the M9, if you shoot prolifically and tend to fill the buffer (IIRC it takes about 7 shots to do so), then force it to show the images it just shot while it's cleaning the buffer, and maybe also try to zoom in on an image... it can lock up the camera and/or result in banding artifacts in the images being written to the card. The M240 with the latest firmware versions is a lot more stable, particularly with the latest firmware. Battery is much bigger and battery life is considerably better than the M9. Overall size is NOT larger. It's something like 1mm larger, but it has a thumb rest that sticks out a bit at the back that probably makes some feel it's bigger, beefier. Maybe it is a bit heavier. That said, the M240's 24MP vs. the M9's 18 does not make a considerable difference (I have both and have tested for this). Sure, the M240 resolves slightly more, but in practical use, it's not often noticeable. More people go on about the CCD vs. CMOS sensor characteristics. IMO, also over exaggerated. You can tweak each in post to render very similarly to the other. Of course, if you prefer not to, then out of camera characteristics will have more sway in such a comparison. But the M240 definitely has a broader dynamic range that tolerates highlight clipping somewhat better than the M9 and results in image files that are quite pliable after the fact (the M9 is very good for lifting shadows, but highlights will clip very quickly in high contrast scenes).
The a7II is a completely different animal. First of all, many people rave about Sony and their sensors. Fact is the M240's sensor is very competitive. Both are 24MP. Both have very similar dynamic range, color quality, etc. The a7II will be a better live view camera, since that is the way you have to use it. But it will also burn through batteries a lot faster. The user interface and feel of the camera while shooting will be a lot different, too. IMO, the Sony cameras feel like computers made to resemble cameras (so much menu diving through horrible menu systems to access various settings), whereas the M240 (and M9) very closely follow Leica M tradition in basic photographic functionality, yet happen to be digital. You should be able to pick up a digital M and shoot with it easily, even if your only prior experience was film rangefinders. Also, the Sony a7 series cameras do not necessarily work well with many rangefinder lenses. This is particularly true with lenses 35mm and wider where the physical effects of the Sony sensor designs can result in degraded image sharpness at the image periphery, particularly as focus approaches infinity.
The reason I mention it might depend somewhat where in the world you live is because the M240, from what I've been told by a Leica CSR, is mandated by Leica to require a very specific inspection, calibration and repair process that involves specific, expensive machinery. If your local Leica distributor does not have the machine, then the camera will be sent to Germany for any servicing, which naturally will increase the time you will be without the camera. And Leica's service times are already quite long. Unfortunately, with the digital cameras, it's not like you can send it to DAG or YY for a CLA like you can your film bodies, if any of them will even touch a digital camera to start with. Sure, you can clean the sensor yourself and try to do rangefinder calibration on the fly, but the digital sensor is a lot more demanding of correct RF calibration than film was. I believe Leica spent a lot of after-sale support time calibrating photographers' M9s and lens collections to work well together, thus implemented a more precise manufacturing and calibration standard for the M240 (and probably for all recently produced lenses, too). But it's such that it requires the special hardware to service the M240 to that standard.