Suppose that a work from home position includes as one of its requirements that the employee live in Kansas. someone (lets call the person A for applicant) lives in Missouri, but has a relative (B) who lives in Kansas. If A gives B's address with B's permission, is A violating any law? What consequences are possible?
If a would be employee simply lies, and claims to live in one state, such as Kansas when s/he actually lives in another, such as Missouri there are several possible negative consequences.
First of all, the employer, if the deception comes to light, might well consider this grounds to fire the employee and provide a bad reference. They might also report this as termination for misconduct, and cause the employee to forfeit unemployment payments.
While employed, the company would presumably be sending state income tax payments to the wrong state, and not to the state where the employee actually lives. This would probably cause the employee to be in violation of the tax laws of the actual state of residence, which probably require proper withholding payments to be made.
Laws and company policies for health insurance coverage and other benefits may well be different between the two states, and the employee might be considered to have claimed improper benefits. This could be construed as insurance fraud, or "material and misrepresentation".
The Federal IRS would possibly notice a mismatch between the employee's address on its records and the address listed on the employer's withholding payments and information returns. This might cause a problem with the withholding payments being properly credited to the employee's tax account.
However, if the employee can arrange to actually stay with his or her relative in the desired state for part of the year, it might be possible to establish a legitimate part-year residence there. Depending on the employer's reasons for demanding an employee have a residence in a particular state, this might suffice. Many people live part of the year in one state and part in another, and tax forms and other legal arrangements for handling such cases are reasonably routine.
It is quite unusual for an employer to insist that an employee be a resident of a particular state, particularly for a work-from-home position. Some government jobs require the employee to be a resident of a particular state, or even a particular city or county. It might be worth finding out why the employer lists this as a requirement. There might be a legitimate way to fulfill the condition. But lying is likely to have negative results.
No, it is not generally considered illegal to work in one state and live in another. It's not unheard of for some people, to use your example, to fly into Wichita, Kansas on a Sunday Night or Monday Morning Flight, stay at a hotel, go to the office, and then fly to Kansas City, Missouri (Yeah, Kansas City isn't in Kansas... the world is weird.) where they have their primary residence (well... conceptually it isn't weird to work all week in one state, and live and reside legally in another. I'm not sure of how close Witchita and Kansas City are to each other.).
In fact, this often occurs because the taxes in one state make living there so much better than living in the state where you are working. This is because Taxes to the State and Taxes to the Federal Government are not assessed on the same form. Generally, you assess what you owe to the Feds and pay that (typically just an income tax.). State Taxes are assessed by separate tax agencies within a particular state and tax different things (Some states don't have an income tax but Tourism Taxes or Sales Taxes or Taxes on certain industries. Alaska for example, makes most of it's revenue off of the oil industry in the state, that it actually pays it's citizens annually so long as they can claim Alaskan citizenship.
By constitutional law, states are not allowed to restrict the movement of people between the states, so any law requiring you to live in the same state you work in is going to fall afoul of this and getting citizenship in a particular state is super easy (barely an inconvenience). Typically, you just take a piece of mail to prove residency to the DMV and get a license to drive in that state... and it's done (Typically your new license will cancel out your old one.). The only legal restriction is that you can only vote in one state during an election and typically if you move too close to the registration, you need to vote absentee in your old state.
Typically your taxes are payed by taking out money from your paycheck (called withheld taxes). Once a year, you have to file tax forms with the federal and state government (Everyone has the deadline on April 15th). For most people, this means taking your W2 form your employer is required to give you, and filling in the numbers on the various tax forms. At the state level, in this situation, you would fill out the Kansas and Missouri forms instead of the one form. States can only tax income you made in that state, so when you earn money in Kansas, Missouri can't take that money. If Kansas doesn't tax income, and Missouri does, well, you made no money in Missouri so they can't tax $0... and Kansas doesn't tax it, so you don't pay an income tax... But if the reverse is true... Kansas taxes your income, but Missouri doesn't... well, then you can deduct income made in Kansas from your Tax in Missouri... meaning Missouri not tax you for what you paid to Kansas... in fact, they might give you might get a tax rebate from Missouri to the tune of what you lost in Kansas.
All that aside, it is a lot of math and law... both subjects many people don't like because it's very dry... but if you can afford to fly to another city and back, and to live in a hotel for five days every week, you can afford to hire an accountant who can do all of this for you... and find more tax breaks to take advantage of.
The commonality of this is dependent on where in the world you actually work and live. It's probably not common in our example, but in Washington D.C., where the greater metropolitan area covers not just the district (its own state for tax purposes) but also portions of Virginia, West Virginia, Maryland, Pennsylvania, and Delaware, this is something that can (and is) done by car. Statistically speaking, in the state of Maryland, 80% of the population live within 40 miles of a state border. And that's not counting the people elected to congress, who will work 5 days a week, and then fly back to their constituencies for the weekend so they can actually meet with the people they represent on the weekend, and then fly back to DC in time for Monday committees. President Joe Biden was famous for taking the Train from DC to DE... but the Congressional Delegation from Hawaii... that's a 12+ hour commute one way, and you will have at the least a 45 minute layover in California.