You may have had a nerve block after surgery to control the pain. A narcotic is used intravenously for the first 24-hours. The femoral nerve in the leg is affected so that pain messages from the knee don't reach the brain.
Surgeons find patients do better in the long run if the immediate pain after surgery is reduced. Faster recovery means fewer complications and a better overall result.
Although the block is meant to stop sensory nerve messages (sensation of pain), the motor portion of the nerve can also be affected. If the motor nerve can't tell the muscle to contract, you can't lift the leg. You can still stand and walk because other nerves and other muscles are working just fine.
The effect should be temporary with a reversal of symptoms soon after the nerve block is stopped. Of course, the pain may return, too. Other nonnarcotic pain relievers are used then.