Joe and Ali had $660 altogether. After Joe gave 1/4 of his money to Ali, Ali had 3 times as much money as Joe. How much money did Joe have at first?

Let's start by setting up some equations:

J + A = 660 (where J is Joe's initial amount and A is Ali's initial amount)
A + (1/4)J = (3/4)J (after Joe gives 1/4 of his money to Ali, Ali has three times as much as Joe)

We can simplify the second equation by multiplying both sides by 4:

4A + J = 3J

Subtracting J from both sides:

4A = 2J

Dividing both sides by 2:

2A = J

Now we can substitute 2A for J in the first equation:

2A + A = 660
3A = 660
A = 220

So Ali had $220 at first. And we know from the second equation that after Joe gave 1/4 of his money to Ali, Ali had 3/4 of Joe's money. So we can set up another equation:

(3/4)J = 220 + (1/4)J

Simplifying:

(1/2)J = 220

J = 440

Therefore, Joe had $440 at first.