What Paul writes about wages in Romans chapter 6 verse 23 may help bring clarity. First, he contrasts sin with grace, showing how believers in Christ no longer serve as slaves to sin, but how they have been set free from servitude to it (verse 6). He says that when they were the servants of sin, they "were free from righteousness" (vs. 20). He uses the analogy of working for wages from their 'master' (sin) but then shows the transforming power of God's grace when their 'old self' is 'crucified with Christ'.
"For the wages of sin is death; but the gift of God is eternal life
through Jesus Christ our Lord." Romans 6:23 A.V.
We all work jolly hard building up a great accumulation of sinful works during our lifetime. Some try not to, of course, but they fail. We all earn our wages of sin, which is death.
God does not withhold wages from workers - that would violate his own righteous laws. But, he has done what was necessary to have sinners freely pardoned so that they could pass over from death to life eternal, through faith in Christ. Thus, we sinners (who were spiritually dead) all die physically, but spiritually - when brought to new life in Christ prior to physical death - we know (from that verse 6) that we no longer 'work' for sin as our 'master'. We belong to another - Christ - and he has given us everlasting life (John 10:28 & 11:25). Yet not as an earned wage. Given purely as unmerited grace.
So, back to Abraham in Romans 4:2-5. He did not have faith in that of which he had no cognizance. Faith is not an emotion, nor a superstition. It is reasonable. God demonstrated something to Abraham, who kept faith, so that his obedience to God made his faith perfect (James 2:21) His faith caused God to evaluate him as being justified in God's sight.
"A dead faith justifies nobody. But the faith with which Abraham
believed was a living, vibrant faith. A faith that realised what he
believed. A faith that laid hold and a faith that made invisible
things real. A faith that justified God and a faith that actually
believed God. Dead assent to technicalities cannot be called a living faith... And Abraham's works proved the reality of his faith.
It was this living faith that God counted." Righteousness, Nigel
Johnstone, pages 70-2 Belmont, 2012
That is the way God "evaluated" Abraham's faith. Living faith, gifted by God and working by love, is the faith God reckons. "For the just shall live by his faith" (Romans 1:17). That is what Paul meant in Romans 4:2-5 (and throughout).
"The Apostle Paul declares that the righteousness of God is imputed to
faith without the deeds of the law... The word used in the Greek
scriptures regarding imputation is the word logizomai... The
imputation of the righteousness of God is absolutely logical. God
logicates righteousness in answer to faith. Is the faith there? Then
it is logical that the righteousness of God should be there also.
Abraham believed God. And it was logical that God saw his own
righteousness upon Abraham. It would be completely unreasonable and
illogical not to see it there!
Romans 4:7 - Blessed are they whose anomia are aphesis,
[iniquities are forgiven] and whose hamartia are epikalupto [sins
are covered]. Blessed the man to whom the Lord will not logizomai
hamartia [impute sin]. (Ibid. p 79 & 82 & 85 & 108)
The problem being grappled with, regarding this English word "credited", is that there is no suitable English word for logizomai. The nearest equivalents seems to be taken as impute, or credit. But 'evaluates' is better, for that gets rid of any false notions about meriting, or being due something. God sees living faith, and evaluates that person lovingly demonstrating such living, God-given faith as demonstrating his righteousness.