The construction for $(0,1/2]$ is in part 3.
1. The initial request can be done via the usual inductive trick.
Enumerate all lines in $\mathbb Z\oplus \mathbb Z$ as $\ell_1,\ell_2,\dots$. Now we assign the values step by step so that after the $n$th step the following conditions are satisfied:
(1) The values are assigned to the set $\bigcup_{i=1}^n \ell_i$;
(2) For every $i\leq n$, the sum of the numbers on $\ell_i$ is $1$;
(3) For every $i>n$, the sum of the values on $\ell_i$ which are already assigned is at most $1-2^{-n}$.
To perform the $n$th step, look at $\ell_n$. It has finitely many already assigned values, their sum is at most $1-2^{1-n}$. Assign the values not exceeding $2^{-n}$ to all remaining points of $\ell_n$ so that the function remains injective, and the sum on $\ell_n$ becomes $1$; clearly, this is possible. This way, we reach (1) and (2); the condition (3) is still fulfilled, since each $\ell_i$ with $i>n$ gets only one more value which does not exceed $2^{-n}$.
2. It is clearly impossible to reach that $f(\mathbb Z\oplus\mathbb Z)=(0,1)\cap\mathbb Q$, as there will be two points assigned the values $>1/2$, and the sum of the values on the line connecting them will be $>1$.
However I think it is possible to reach $f(\mathbb Z\oplus\mathbb Z)=(0,1/3)\cap\mathbb Q$. For that purpose, choose pairwise disjoint parabolas $p_1,p_2,\dots$ and put the numbers fulfilling the following conditions after the $n$th step:
(1') the already assigned points form the set $\bigcup_{i=1}^n (\ell_i\cup p_i)$;
(1.5) The set of assigned values contains $(2^{-n-10},1/3)\cap\mathbb Q$, and the sum of all other used numbers is finite.
(2)--(3) are the same.
To perform the step, firstly fill the parabola $p_n$ in order to satisfy (1.5), and then fill $\ell_n$.
3. Here is a refinement which seemingly works for $(0,1/2]\cap \mathbb Q$.
Part 1. We intend to choose an infinite set of points $S$ and call the lines joining two points in $S$ special. The condition to be satisfied is that every (possibly special) line $\ell$ contains only finitely many points covered by special lines different from $\ell$.
Enumerate the lines as $\ell_1,\ell_2,\dots$. Collect $S$ inductively. On $n$th step, we will fix the infinite sets on $\ell_1,\dots,\ell_n$ which will not be covered by special lines (different from $\ell_1,\dots,\ell_n$), and $S$ will contain $n$ points. The first step is obvious: we put any point to $S$ and fix all points different from it on $\ell_1$.
On the $n$th step, line $\ell_{n+1}$ crosses the already existing special lines (different from $\ell$) by finitely many points. We claim that all other points will be uncovered forever.
Now, if $S=\{s_1,\dots,s_n\}$ at this moment, we are to choose $s_{n+1}$. Choose an irrational direction $\vec v$ and draw the rays from $s_1,s_2,\dots,s_n$ in that direction; each crosses $\ell_1,\dots,\ell_{n+1}$ at a non-lattice point. If now we choose $s_{n+1}$ sufficiently far in that direction, the rays $s_is_{n+1}$ will be close enough to those rays, so they will cross $\ell_1,\dots,\ell_{n+1}$ also at non-lattice points. The step is complete.
Part 2. Denote by $T$ the set of points on the special lines, and set $P=\mathbb Z^2\setminus T$. There are infinitely many non-special lines, and each contains infinitely many points not in $U$. Now we can choose a sequence $P_1,P_2,\dots$ of pairwise disjoint infinite subsets of $U$ such that no three points in $P_i$ are collinear. Each $P_i$ is easily chosen by a similar (yet easier) induction.
Part 3. Now we put the numbers. On Step 0, we put all rational numbers from $[1/8,1/2]$ into the points of $S$. The following steps are performed to maintain the following after the $n$th step:
(A) the numbers are put into $S\cup\bigcup_{i=1}^n (P_i\cup \ell_i)$; moreover, all numbers from $[2^{-2n-3},1/2]$ are already used;
(B) the sum of all numbers on $\ell_i$ ($i\leq n$) is $1$;
(c) for every $i>n$, the sum of numbers on $\ell_i$ is smaller than $1$; moreover, if $\ell_i$ is not special, then this sum is at most $1-2^{-n}$.
After Step $0$, all three conditions are satisfied.
Now we are to perform Step $n$. We first put all the numbers from $[2^{-2n-3},2^{-2n-1})$ to the points of $P_n$. Each special line gets none of them, while each non-special line gets an increment of at most $2^{-2n}$, so the sum on it is at most $1-2^{1-n}+2^{-2n}$ now.
Now $\ell_n$ has infinitely many empty points. Some of them are special, i.e., belong to other special lines. Firstly, fill the special points so that the special lines will not be overfull. Then fill the remaining points on $\ell_n$ (there are infinitely many of them) so that the sum on $\ell_n$ becomes $1$. It is easy to see that this is possible, as every subinterval $*\alpha,\beta)$ in $(0,2^{-2n-3})$ contains infinitely many of unused numbers.
Now, each special line still satisfies (c). Each other line now has a sum of at most $1-2^{1-n}+2^{-2n}+2^{-2n-1}<1-2^{-n}$, as desired. So the step is complete.