When I set the aperture and shutter speed on my a6000 in manual mode the aperture always changes when I take the photo. I am using a sony 24-240mm lens f/3.5-6.3. It does the same in aperture mode.
Your Sony 24-240mm f/3.5-6.3 lens is not capable of opening up to f/4 through out its entire focal length range. By the time you zoom all the way to 240mm, the widest possible aperture is f/6.3. Your camera senses that and compensates accordingly.
For more about variable aperture vs. constant aperture zoom lenses, please see:
How do zoom lenses restrict their widest aperture at the telephoto end?
Why does my aperture setting change as I zoom on my DSLR kit lens?
Why do zoom lenses and compact cameras have varied maximum aperture across the zoom range?