I think it’s important to note that it’s a little misleading to think of it as being paid to go to school. In most cases, especially past your first year and unless you’re on some special grant, you are paid because you are working for your advisor on his research projects. You have a boss telling you what to code and they will have a large say in what you’re working on.